2012-02-07 59 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