简体   繁体   English

URL mod重写响应500内部服务器错误

[英]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". 我试图重写我的网站URL,这给我错误“ 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 这真的意味着/index.php如果您只写它而不带/的话,那将意味着/var/www/index.php之类的东西。

You got a 500 error casued ba a infinity loop. 无限循环导致出现500错误。

Additionaly you neet to add the QSA flag, otherwise you will get index.php as shopName 另外,您无需添加QSA标志,否则您将获得index.php作为shopName

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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