Need help with htaccess

xgf666

Regular Member
Joined
Jan 18, 2011
Messages
206
Reaction score
98
Hi ! :amish:

I need a simple htaccess code, I tried several generators but obviously there is something wrong with me. I just need a redirection script like:

IP 127.0.0.1 127.0.0.2 go to index.html
Else go to comingsoon.html

Would someone be kind enought and write me this short code ?

Thank you !!
 
try this..

PHP:
  RewriteEngine on
RewriteCond %{REQUEST_URI} !/comingsoon.html$ 
RewriteCond %{REMOTE_HOST} !^123\.123\.100\.100
RewriteRule $ /comingsoon.html [R=302,L]

This will redirect all the IP's to comingsoon.html and allow the ip mentioned (123.123.100.100) to the default index page
 
Thanksss !!! If I want to add a second IP I had
RewriteCond %{REMOTE_HOST} !^124\.124\.100\.100
below the line ?
 
Last edited:
Yes you just need to add one more line to add new IP to be allowed i.e a new rewrite condition for every new IP.
 
oups i'm afraid it didn't worked :(

when I added the code with my IP I couldn't access any part of the site but the comingsoon page. and the comingsoon page was displayed as a blank page
 
Last edited:
Did you ensure you changed the IP in the script to your external IP?
 
yep I used whatismyipadress dot com
 
You can replace the last line with this and try..

RewriteRule \.html$ /comingsoon.html [R=302,L]
 
Not working :(

Here's the solution that worked for me


RewriteEngine on
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123
RewriteCond %{REQUEST_URI} !/coming-soon\.html$
RewriteRule (.*)$ /coming-soon.html [R=302,L]
 
Last edited:
Back
Top