i have the following .htaccess file RewriteEngine on RewriteCond %{REQUEST_URI}!^login.php(.*)$ RewriteRule (.*) login.php?page=$1
if i access something like addArticle.php and echo the $page variable in login.php it says login.php
jdMorgan
3:37 pm on Jul 3, 2004 (gmt 0)
A pattern error in the RewriteCond may be causing the rule to always match. Try this:
RewriteEngine on RewriteCond %{REQUEST_URI} !^/login.php RewriteRule (.*) login.php?page=$1 [L]
Jim
WhosAWhata
3:08 am on Jul 4, 2004 (gmt 0)
it didn't fix it
i changed the [L] to [R=301] to see what variable was being passed through the address bar
it started a loop between login.php?page=login.php and addArticle.php
WhosAWhata
3:10 am on Jul 4, 2004 (gmt 0)
as you can see, not only did it cause a loop, the login.php?page still =login.php
jdMorgan
3:37 am on Jul 4, 2004 (gmt 0)
Well then, login.php must not be in your web root directory, so remove the start anchor from the RewriteCond pattern:
RewriteEngine on RewriteCond %{REQUEST_URI} !/login\.php RewriteRule (.*) login.php?page=$1 [L]
If that doesn't work, then you've got some other rule or script doing another redirect that is interering with this one.
Jim
[edited by: jdMorgan at 3:49 am (utc) on July 4, 2004]
jdMorgan
3:40 am on Jul 4, 2004 (gmt 0)
Also, check to be sure the $page variable is the correct one to reference in your script. I'm not familiar with the php variables, but I think your script should be checking the query string, not the requested page.
Jim
WhosAWhata
4:00 am on Jul 4, 2004 (gmt 0)
i found the errors, thanks
RewriteEngine on RewriteCond %{REQUEST_URI}!/login\.php RewriteRule (.*) login.php?page=$1 [L]
as per your suggestion i noticed neither of us had done this (it was causing the loop -until your last one)
WhosAWhata
4:01 am on Jul 4, 2004 (gmt 0)
P.S.
how do you get the space between the } and! chars? i have tried [pre] and [code]