Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a wordpress site that is at a URL and I am wanting to redirect all traffic except a few IP address to a coming soon type page.

So if I had 3 IP's, those 3 IP's would see the current wordpress site and all other traffic would be redirect to a certain URL

Is this possible with Apache? Something that could be put in an .htaccess file?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can do this with mod_rewrite in a .htaccess file:

RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^123\.255\.123\.255 [OR]
RewriteCond %{REMOTE_ADDR} ^124\.255\.124\.255 [OR]
RewriteCond %{REMOTE_ADDR} ^125\.255\.125\.255
RewriteRule ^(.*)$ http://example.com/ [R=301,L]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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