6

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).

Tamer Shlash
  • 9,314
  • 5
  • 44
  • 82

2 Answers2

14

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

Oussama Jilal
  • 7,669
  • 2
  • 30
  • 53
5

Try to remove Options +FollowSymlinks , some servers won't allow you to overwrite a php.ini setting.

Giona
  • 20,734
  • 4
  • 56
  • 68