2013-05-02 80 views

回答

1

我需要/start重定向到/start/index.html和其他一切(/任何東西)到/index.html。什麼是正確的正則表達式rewriterule呢?

你可以在根目錄中的一個.htaccess文件試試這個:

Options +FollowSymlinks -MultiViews 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_URI} !index\.html  [NC] 
RewriteRule ^start/(.*) /start/index.html?$1 [L,NC,QSA] 

在規則,anything作爲查詢傳遞給index.php和QSA標誌添加進來的一個時出現。

要將anything作爲路徑段,請將?$1替換爲/$1並刪除QSA標誌。它沒用,因爲任何傳入的查詢都會自動添加。使用[R = 301,L,NC,QSA]替換[L,NC,QSA]