2011-11-25 66 views

回答

4

把下面的規則.htaccess文件在你的站點的根目錄

RewriteEngine On 
RewriteBase/

#only for the root directory 
RewriteCond %{REQUEST_URI} ^/$ 
#if the uri is not already index.php 
RewriteCond %{REQUEST_URI} !^/index.php [NC] 
RewriteRule ^$ /index.php [R=301,L] 

如果仍存在與其他規則相沖突,則可以進一步限制這個規則只是一個page=查詢字符串PARAM請求通過在上述重寫規則之前添加跟隨條件

# to limit further to only the requests with a page= param 
RewriteCond %{QUERY_STRING} ^([^&]+&)*page=.*$ [NC] 
+0

這不起作用。它沒有重定向我最初發布的鏈接,並且打破了它不應該鏈接的鏈接。 –

+0

我通過添加另一個條件來限制此規則的範圍。讓我知道這個是否奏效。 –

+0

好吧,現在完美。非常感謝你的幫助。 –