htaccess全部重写为index.html

问题描述:

我正在尝试编写.htaccess文件,以便无论用户请求什么,他都将拥有页面index.html

I'm trying to write the .htaccess file so that whatever the user requests, he will have the page index.html

我写了这个:

Options +FollowSymlinks
RewriteEngine on
RewriteRule .* index.html [NC]

我知道这将导致:无论传入请求URL是什么,即www.domain.com/***(斜杠之后的内容),结果将是页面www.domain.com/index.html

I understand that this will cause: whatever the incoming request URL is, i.e, www.domain.com/*** (whatever comes after the slash), the result will be the page www.domain.com/index.html

但是,出现服务器错误.我想念什么?

However, I'm getting a Server error. What am I missing?

注意:我不希望它是永久重定向,我只是想在index.html页面上隐藏"我网站的内容几个小时(这表明该网站正在维护中).

NOTE: I don't want it to be permanent redirect, I'm just trying to "hide" the content of my site for a couple of hours with that index.html page (which says that the site is under maintenance).

尝试删除Options +FollowSymlinks,某些服务器不允许您覆盖php.ini设置.

Try to remove Options +FollowSymlinks , some servers won't allow you to overwrite a php.ini setting.