• 13
• 18
• 19
• 27
• 10

[web] .htaccess regexps

This topic is 3693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I wrote the following in my .htaccess file:
RewriteEngine on

RewriteCond $1 !^entry.php RewriteRule ^([^?]*)?(.*)$ http://www.paris-jourdan.ens.fr/pse-eep/entry.php?q=/$1&$2 [L]

RewriteCond $1 !^entry.php RewriteRule ^([^?]*)$ http://www.paris-jourdan.ens.fr/pse-eep/entry.php?q=/\$1 [L]
This file is placed at the root for 'http://www.paris-jourdan.ens.fr/pse-eep/'. My understanding is that, when visiting:
http://www.paris-jourdan.ens.fr/pse-eep/FOOBAR
it should rewrite it to:
http://www.paris-jourdan.ens.fr/pse-eep/entry.php?q=/FOOBAR
This happens correctly. However, when visiting:
http://www.paris-jourdan.ens.fr/pse-eep/FOOBAR?A=B&C=D
it should be rewritten to:
http://www.paris-jourdan.ens.fr/pse-eep/entry.php?q=/FOOBAR&A=B&C=D
however, it seems to be instead rewritten to:
http://www.paris-jourdan.ens.fr/pse-eep/entry.php?q=/FOOBAR
because entry.php does not see any GET argument besides 'q'. Attempting to enable RewriteLog returns a 500 internal server error, regardless of the target file I choose, so I could not determine the cause of this problem.