2013-02-11 56 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