2012-02-07 60 views
0

我需要有mod_rewrite的规则去除的index.php

site.com/index.php?s=super-smash-bros-baww-SUzohN

重定向到

site.com/super-smash-bros-baww-SUzohN

我该怎么做?

注意单词的数量可以是不同的e.g:/index.php?s=aaa-bbb-ccc需要去/aaa-bbb-ccc

感谢

回答

1

尝试添加下列到.htaccess文件在您的网站的根目录。

RewriteEngine on 
RewriteBase/

#redirect to remove index.php 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?s=([^\ &]+) [NC] 
RewriteRule^%1? [L,R=301] 

#process the SEF Url with index.php 
RewriteRule ^([-a-zA-Z]+)$ index.php?s=$1 [L] 
+0

它的工作,谢谢。 – giany 2012-02-07 14:49:29