Reputation: 467
I need to set up a redirect in Apache using the .htaccess
file. The redirect would be used to force users into a maintenance page temporary.
How can I redirect users from http://devsparkle.me and http://www.devsparkle.me to http://www.devsparkle.me/maintenance?
and
How can I prevent localhost, 127.0.0.1 users from being redirected?
Upvotes: 0
Views: 70
Reputation: 143886
Try:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1
RewriteCond %{HTTP_HOST} ^(www\.)?devsparkle\.me$ [NC]
RewriteRule ^(?!maintenance).* /maintenance [L,R]
Upvotes: 2