2012-12-18 40 views
0

我有以下.htaccess文件:的DirectoryIndex的.htaccess指令被覆盖的RewriteRules

DirectoryIndex index.html 

Options +FollowSymLinks 
RewriteEngine On 

AddEncoding gzip .gz 
AddEncoding gzip .gzip 
<FilesMatch "\.(js.gz|js.gzip)$"> 
    ForceType text/javascript 
</FilesMatch> 
<FilesMatch "\.(css.gz|css.gzip)$"> 
    ForceType text/css 
</FilesMatch> 

#RewriteCond %{REQUEST_URI} .*/http-bind 
#RewriteRule (.*) /http-bind [L] 

RewriteCond %{REQUEST_URI} !^/index\.php 
RewriteCond %{REQUEST_URI} !/ow_updates/index\.php 
RewriteCond %{REQUEST_URI} !/ow_updates/ 
RewriteCond %{REQUEST_URI} !/ow_cron/run\.php 
RewriteCond %{REQUEST_URI} !/index\.html 
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$ [NC] 
RewriteRule (.*) index.php 

我想要的一切,在.htaccess别的工作,就像是:重定向除了那些!指定的所有请求index.php。但是,我第一次加载网站时需要加载index.html,之后它们会继续加载index.php

所以我增加了行DirectoryIndex index.html开头,然后增加了行RewriteCond %{REQUEST_URI} !/index\.html,希望当用户键入http://url.com,他们被带到index.html文件,从中他们会去的内页像http://url.com/homepage这将全部都是由index.php处理的请求。

但是这不起作用。我使用的软件是Oxwall。该网站只是忽略了第一行,并不断加载index.php。我能做些什么来弥补这一点?谢谢。

回答

1

您可以使用会话或cookie轻松处理此问题。您可以使其始终将某人重定向到index.php,并在index.php中包含index.html文件以显示他们是否第一次访问。如果将它们重定向到html文件,它将不起作用(.htaccess会阻碍),但如果包含该文件,那么它应该可以正常工作。

+0

谢谢;是的,这确实是一种可能性,但我想避免它,因为在主站点脚本中已经有很多cookie /会话操作,并且我会干涉该逻辑...... –