0

When updating my magento shop, I would like to redirect all IP except mine to maintenance page.

I used to do that with .htaccess file :

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteCond %{REMOTE_HOST} !^5.6.7.8
RewriteRule .* http://www.google.fr [R=302,L]

It was working well, but I now have some problems. Sometimes it works, sometime not, and I have to disable redirection to access my site. Sometimes I can access the frontend but not the backend...

Any idea?

Thanks for your help,

1 Answer 1

0

You can easily redirect to the maintenence page with the following code.

This is a promising code, which we are achieving using mod_rewrite module.

<IfModule mod_rewrite.c>
 RewriteEngine on
 #allowed ips start
 RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
 RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
 RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
 #allowed ips end
 RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
 RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
 RewriteRule .* /maintenance.html [R=302,L]
</IfModule>

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.