Apache 2.2重写 – 强制所有的请求index.html

我需要强制所有的请求,而不pipe它们是什么index.html。 不幸的是,我所尝试的一切都没有正常工作。

以下似乎应该工作,但它不。 我的理解是,对于任何不以/index.html结尾的内容来实际请求index.html文件。

redirect302!^ / index.html http://www.example.com/index.html

任何帮助/澄清将不胜感激。

在根文件夹上使用.htaccess,可以完成这项工作:

RewriteEngine on RewriteCond %{REQUEST_URI} !^/index.html$ RewriteRule . index.html [R=302,L] 

条件和规则是,如果请求不匹配index.html它将redirect到它