2012-11-18 126 views
3

我正在将站点永久脱机,但在它关闭之前,我在其上显示了一个或两个启动页面。我如何编辑我的.htaccess文件来显示该启动页面?它需要允许页面本身(根目录)以及/ images目录中的两个图像。使用.htaccess重定向除三个以外的所有页面

回答

9

将下面的配置到位于你的网站的根.htaccess

RewriteEngine On 

RewriteCond %{REQUEST_URI} !^/splash.html$ 
RewriteCond %{REQUEST_URI} !^/images/usedimage.png$ 
RewriteCond %{REQUEST_URI} !^/images/anotherusedimage.png$ 
RewriteRule .* splash.html [R=301,L] 
+0

刚刚试了一下,Chrome的报告重定向循环(错误310)。 – vaindil

+0

@StevenH如果splash.html列在'RewriteCond'列表中,请检查doblecheck ...你确定,尝试删除'RewriteCond'中的前导斜杠'/' –

+0

是的,我证实了'splash .html'既在根目录中,也在'RewriteCond'中。我尝试删除前导'/',但我仍然得到一个重定向循环。除了你给我的代码(编辑我的文件名)之外,.htaccess文件中没有任何内容。 – vaindil

相关问题