简体   繁体   中英

Apache mod_rewrite not treating a rewritten url?

RewriteEngine on
RewriteRule ^/(.*)/settings.php$ /settings.php?session=$1
RewriteRule ^/register/(.*)/(.*) /register/$2?session=$1

I'm putting the session in the url but it's not working. It tries to treat the session as a file:

[Mon Apr 16 17:37:05 2012] [error] File does not exist: /home/delta/public_html/register/D7yuzHOn3gx

What is wrong with this?

Thank you for your time.

Change your rules to:

RewriteRule ^(.*)/settings\.php$ settings.php?session=$1 [L,NC,QSA]
RewriteRule ^register/([^/]*)/(.*) register/$2?session=$1 [L,NC,QSA]

And remember RewriteRule start matching after first slash / .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM