Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using .htaccess to redirect all pages except three

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.

like image 472
vaindil Avatar asked Nov 18 '12 18:11

vaindil


1 Answers

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]
like image 160
Kamil Šrot Avatar answered Oct 04 '22 00:10

Kamil Šrot