Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 780
Aaron Lee Avatar asked Jan 24 '12 10:01

Aaron Lee


People also ask

Does .htaccess do redirect?

Use a 301 redirect . htaccess to point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "example.com" domain.


1 Answers

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] 
like image 167
kufi Avatar answered Sep 28 '22 09:09

kufi