Skip to content
Advertisement

.htaccess – redirect everything

I am trying to get a landing page to work while I am doing scheduled updates on my site.

So basically all my original files will still exist in the directory including my index.php file but I’ve added another index1.html, so whenever I do an update I just want to be able to un-comment a line in my .htaccess file and everything will redirect to the landing page.

In my .htaccess file I have:

Options -MultiViews
RewriteEngine on
RewriteRule ^(.*)$ index1.html?path=$1 [L,NC,QSA]

This works for me in so far as any file or sub-directory I go to like example.com/whatever will redirect but example.com will still go to the original index.php which is what I want to be updating.

Advertisement

Answer

This line did exactly what I wanted:

DirectoryIndex index1.html
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement