Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess rewrite all to index.html

I'm trying to write the .htaccess file so that whatever the user requests, he will have the page index.html

I've written this:

Options +FollowSymlinks
RewriteEngine on
RewriteRule .* index.html [NC]

I understand that this will cause: whatever the incoming request URL is, i.e, www.domain.com/*** (whatever comes after the slash), the result will be the page www.domain.com/index.html

However, I'm getting a Server error. What am I missing?

NOTE: I don't want it to be permanent redirect, I'm just trying to "hide" the content of my site for a couple of hours with that index.html page (which says that the site is under maintenance).

like image 590
Tamer Shlash Avatar asked Sep 19 '12 13:09

Tamer Shlash


1 Answers

If you want to redirect everything to temporary maintenance page, you can do :

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/maintenance.html$
RewriteRule .* /maintenance.html [L,R=302]

the R=302 flag is used to generate a temporary redirect

like image 183
Oussama Jilal Avatar answered Oct 15 '22 20:10

Oussama Jilal