URL重写500内部服务器错误

时间:2015-03-05 09:01:33

标签: php apache .htaccess mod-rewrite

原始网址:mydomain/index.php?lang=english
   我想要网址:mydomain/english

我的.htaccess文件如下:

RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?lang=$1 [L]

但我得到500内部服务器错误。我怎样才能解决这个问题?

感谢。

2 个答案:

答案 0 :(得分:0)

这个怎么样:

RewriteRule ^([^/]+)$ ?lang=$1 [L] # and maybe QSA too

答案 1 :(得分:0)

重写引擎循环,直到URI停止更改。尝试添加一些条件:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)$ /index.php?lang=$1 [L]
相关问题