2012-11-03 31 views
0

我想縮短與我的htaccess的一個問題。總是有問題與htaccess

RewriteBase/
    RewriteRule ^(.+)/$ /$1 [R=301,L] 
    RewriteRule ^profile/(.*)$ details.php?profile=$1 [L,NC,QSA] 
    RewriteRule ^industry/(.*)$ category.php?industry=$1 [L,NC,QSA] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^index.php$ /index.php [L,NC] 

它很好,只要有個人資料或行業的匹配工作..但現在我想要實現的是,當上述任何規則,然後匹配它應該重定向用戶到主頁(www.example.com)。發生了什麼是它重定向到index.php但問題是在瀏覽器上它仍然顯示(www.example.com/skfjsf/sfjsfk)我想將其更改爲(www.example.com)

回答

1

嘗試:

RewriteRule ^index.php$ /index.php [r=301,nc]  

//instead of 

RewriteRule ^index.php$ /index.php [L,NC] 
+0

感謝你回答PolCPP但偏偏當我在瀏覽器類似http://www.example.com/pfdsjfage/dgsd輸入重定向到的index.php,但在瀏覽器窗口中它仍然顯示的http:// www.example.com/pfdsjfage/dgsd我想展示它像http://www.example.com/index.php或http://www.example.com/ – SmartDev

+0

是的,我知道了... RewriteRule 。 /index.php [R = 301,L]謝謝 – SmartDev

+0

啊,dang錯別字。沒問題:) htaccess很煩人 – PolCPP