简体   繁体   中英

URL mod rewriting response 500 Internal Server Error

I'm trying to rewrite my site URL, This gives me the error "500 Internal Server Error". This is my code

RewriteEngine On
RewriteRule ^index$ /index.php [L]
RewriteRule ^([^/]*)$ /index.php?shopiId=5&shopName=$1 [L]

Please help.

Try this.

RewriteEngine On
RewriteRule ^index$ index.php [L,QSA]
RewriteRule ^([^/]*)$ index.php?shopiId=5&shopName=$1 [L,QSA]

Dont start to section with a / because you dont like reffer to an absolute path. This would realy mean /index.php If you just write it without leading /, it would mean something like /var/www/index.php

You got a 500 error casued ba a infinity loop.

Additionaly you neet to add the QSA flag, otherwise you will get index.php as shopName

http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_qsa

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