Jump to content
  • Advertisement
Sign in to follow this  
ToohrVyk

[web] .htaccess regexps

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

If you intended to correct an error in the post then please contact us.

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.

Share this post


Link to post
Share on other sites
Advertisement
Instead of just [L] behind those queries, use [L,QSA]. QSA stands for Query String Append.

Mod_rewrite is used to rewrite URLs, not query strings so by default you can't match against them (You need to use RewriteCond directives for that).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!