简体   繁体   中英

Odd behavior adding RewriteRule in .htaccess

I have the following rule:


  RewriteRule ^(image/[0-9]*/(.*))?$ image.php?prettyUrl=true&nav=$1 [QSA,NC,L]

This is supposed to replace


  http://mysite.com/image/12345/imagename.png => http://mysite.com/image.php?pretyUrl=true&nav=image/12345/imagename.png

For the particular case where the pretty url contains '/image/' the $_GET array is empty. If I use a different name like 'images' or 'asdfg' the $_GET array will contain both pretyUrl and nav.

Any idea why?

Thanks!

If the rewrite rule must work for every URL in image/ , (and the /1234/ digits part is not required), then this may be what you are looking for:

RewriteRule ^(image(/.*)?)$ image.php?prettyUrl=true&nav=$1 [QSA,NC,L]

If you can phrase your question a bit more specifically, a better solution can be refined.

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