使用.htaccess重定向除三个页面以外的所有页面 [英] Using .htaccess to redirect all pages except three
本文介绍了使用.htaccess重定向除三个页面以外的所有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使网站永久脱机,但是在该网站出现故障之前,我会在其上显示初始页面一两个星期。如何编辑.htaccess文件以显示该初始页面?它需要允许页面本身(根目录)以及/ images目录中的两个图像。
I am taking a site permanently offline, but I'm displaying a splash page on it for a week or two before it goes down. How can I edit my .htaccess file to display that splash page? It needs to allow the page itself (root directory) as well as two images in the /images directory.
推荐答案
将以下内容放置配置到位于网站根目录的 .htaccess
中:
Place the following configuration into your .htaccess
located in the root of your website:
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]
这篇关于使用.htaccess重定向除三个页面以外的所有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文