Forum Moderators: phranque
I'm trying to rewrite /folder1/folder2/greg.php to /folder1/folder2/fred.php, then place 'greg.php' into the query string for fred.php
RewriteEngine On
RewriteBase /folder1/folder2/
RewriteRule ^(.*)$ fred.php?page=$1 [L]
This correctly rewrites to fred.php, but then insists on placing fred.php, instead of greg.php, into page=$1.
This is doing it on both my development server and the hosting server, so I'm pretty sure there's no configuration problems. I also have several other sites running mod_rewrite without any problem on both servers.
the query string is used to write out the content of fred.php, but of course that's failing.
I thought that when you do a rewrite you are telling mod_rewrite:
take what is in (.*), put it into the $1, then rewrite using that value. Obviously I'm missing something there conceptually about how mod_rewrite works.
<added>
so this is what ended up working:
RewriteEngine On
RewriteBase /folder1/folder2/
RewriteCond %{REQUEST_URI}!fred\.php$
RewriteRule ^(.+)$ fred.php?page=$1 [L]
[edited by: isitreal at 8:28 pm (utc) on July 26, 2004]