Redirect ALL requests under a domain to static page
62,251
I actually ended up finding the answer on ServerFault:
https://serverfault.com/questions/32513/url-redirect-to-another-page-on-the-same-site
"This example will 302 redirect all URLs to "/underconstruction.html":
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/underconstruction.html
RewriteRule ^ /underconstruction.html [R=302]
(which translates as "If URI is not /underconstruction.html, redirect to /underconstruction.html")" - Tommeh
Comments
-
barfoon almost 4 years
I am trying to redirect ALL requests for mydomain.com whether they are something like:
- http://www.mydomain.com
- http://mydomain.com
- http://mydomain.com/photos
- http://mydomain.com/index.php?id=672
to be redirected to
As long as it has mydomain.com in it, they should see this page - its a we'll be back soon message.
Should I do it in .htaccess or conf? How?
-
T. Brian Jones over 12 yearsIf this does not work at first, try changing the apache.conf (on linux: /etc/httpd/conf/httpd.conf ) setting
AllowOverride None
toAllowOverride All
inside the<Directory "/var/www/html">
configuration. Then restart apache ( on linux: /etc/init.d/httpd restart )