You are here: Re: mod rewrite « PHP Programming Language « IT news, forums, messages
Re: mod rewrite

Posted by Jon Slaughter on 05/03/07 08:55

"Schraalhans Keukenmeester" <invalid@invalid.spam> wrote in message
news:pan.2007.05.03.07.09.47.57787@invalid.spam...
> On Wed, 02 May 2007 22:15:18 -0500, Jon Slaughter wrote:
>
>> How the heck do I get mod rewrite to add extensions to any file?
>>
>> RewriteRule ^(.*)$ $1\.php [nc]
>>
>> To me that should find any group of characters(such as any path) and then
>> add the .php to the end? But this doesn't work and gives me a server
>> error.
>> If I remove the $ in front of the 1 then it does but ofcourse all my
>> links
>> end up as 1.php
>>
>> I can also do something like
>>
>> RewriteRule ^3(.*)$ $1\.php [nc]
>>
>> and all my links will be redirected to 3---.php
>>
>> What I want is to take
>>
>> [url] into [url].php
>>
>> (without query string and or other special chars such as ([^&?]&) or
>> [QSA])
>>
>>
>> I just can't understand why the following does not work ;/
>>
>> RewriteRule ^(.*)$ $1\.php [nc]
>>
>> $1 should be whatever is matched by (.*)? (which should be the whole
>> url?)
>> In any case I can't see how its an error?
>>
>> Thanks,
>> Jon
>
> http://www.workingwith.me.uk/articles/scripting/mod_rewrite will probably
> help you get to grips with mod_rewrite, at least it scratches the surface
> of what's possible.
>

Yeah, I've seen that site... but there seems to be something wrong with my
code that isn't explained on such basic sites

RewriteRule ^(.*)$ 1\.php [nc]

works fine for what its does but I cannot refer to the group (.*) using $1
like I am suppose to be. If the pattern is not so general then it works...
it acts like its not matching correctly.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация