2013-02-11 58 views
0

這是我的htaccess文件的Drupal集的當前重寫規則:重寫規則自定義索引文件的Drupal安裝

RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_URI} !=/favicon.ico 
    RewriteCond %{REQUEST_URI} !=/index.html 
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 

這個效果很好,但問題是,我想有一個自定義頁面將打開當人們瀏覽到網站時。更具體的:

www.company.com/應該打開index.html 所有其他頁面應該使用Drupal的默認重寫。

我試着編輯DirectoryIndex,但所有頁面都重定向到index.html。

DirectoryIndex index.html index.php 

我也嘗試添加不同的重寫規則,但我沒有任何運氣。 Htaccess不是我最好的技能。

RewriteCond %{REQUEST_URI} ^/$ [NC] 
    RewriteRule ^/$ /index.html [L] 

可能會有一個簡單的解決方案,但我不知道該怎麼做。

有誰知道如何解決我的問題?

謝謝!

回答

0

嘗試在規則中添加301代碼,意味着永久移動。

RewriteCond %{REQUEST_URI} ^/$ [NC] 
RewriteRule ^/$ /index.html [L,R=301] 
+0

感謝您的回覆。我嘗試添加301規則,但沒有解決問題。 這是我現在有:???? '的RewriteCond%{HTTP_HOST} ^(WWW)domain.com(/)$ 的RewriteCond%{REQUEST_URI} ^/$ 重寫規則^/$的index.html [ L] 的RewriteCond%{REQUEST_FILENAME}!-f 的RewriteCond%{REQUEST_FILENAME}!-d 的RewriteCond%{REQUEST_URI}!=/favicon.ico的 的RewriteCond%{REQUEST_URI}!=/index.html中 的RewriteCond%{REQUEST_URI }!^ /?$ RewriteRule ^(。*)$ index.php?q = $ 1 [L,QSA]' 這很好,但是當我轉到domain.com/?q=時,它顯示我的index.html文件而不是Drupal節點。 – 2013-02-12 21:12:19