Search code examples
.htaccesshttp-redirect

.htaccess redirect to all IP's but mine


Basically, I am trying to work on the front end of a website, but I would like everyone else but myself to be redirected to a construction page if you like. I currently have:

redirect 301 /index.php http://www.domain.com/construction.php

While this works, it works to well, I would like to be able to still see the live site myself, is it possible to exclude everyone but my IP?

Thanks again.


Solution

  • You could do it with mod_rewrite

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !=123.45.67.89
    RewriteRule index.php$ /construction.php [R=301,L]