htaccess RewriteRule没有正确执行

时间:2016-04-08 17:12:01

标签: .htaccess

我想弄清楚为什么我的Rewriterule doest正常工作。

  RewriteRule ^en/(.*).php?(.*)#(.*) $1.php?$2&language=english#$3 [NC,L,QSA] 
  RewriteRule ^en/(.*).php?(.*) $1.php?$2&language=english [NC,L,QSA] 
  RewriteRule ^en/(.*).php#(.*) $1.php?language=english#$2 [NC,L,QSA] 
  RewriteRule ^en/(.*).php$ $1.php?language=english [NC,L,QSA] 
  RewriteRule ^en/$ index.php?language=english  [NC,L,QSA] 

我目前可以使用www.example.com/?language=english

查看英文版

但是当我要打开www.example.com/en时,我会看到404页。

1 个答案:

答案 0 :(得分:2)

尝试:

RewriteRule ^en/(.*)\.php $1.php?language=english [NC,L,QSA] 
RewriteRule ^en/?$ index.php?language=english  [NC,L,QSA]