将所有请求重定向到index.html
问题描述:
我试图将所有未知请求重定向到index.html。例如,如果有人输入:将所有请求重定向到index.html
http://IP_Address/blah_blah _blah
然后它必须重定向到index.html。下面是我曾尝试代码:
我/var/www/some_dir/index.html
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule . index.html [R=302,L]
当我尝试这种代码在我的根目录,它重定向到http://Ip_address/var/www/accesspage/index.html
我想http://Ip_address/index.html
但我想通过index.html重定向到其他html页面
下面是我的Apache配置
DocumentRoot /var/www/access/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/access/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
如果我没有弄错,你的web服务器配置会变得很棘手。 – user982270 2013-03-01 05:59:01
我已经添加了apache congi来检查它,它的所有版本 – EnterJQ 2013-03-01 06:03:10
试试这个:'RewriteRule。 /index.html [R = 302,L]' – 2013-03-01 06:43:36