0

I'm having a bit of a trouble finding the right way to this:

I'm about to launch a site, www.domain.com, but it's not quite yet ready for the public eyes just yet. So I want to redirect all visitors (except myself) to www.domain.com/teaser.html.

How can I do this, so I keep the site content hidden from visitors, without creating a loop if I redirect base url? How would a htaccess string look like?

If I create something like this:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^xxx.xxx.xxx.xxx
RewriteRule .* /coming-soon.html [R=302,L]

It just create a loop. How can I do this without creating a loop?

  • Well, you implement the redirection rules and add a condition that excludes your specific IP address. What is the question here? Many examples for such conditions can be found here on SO or on google. Also the documentation of apaches rewrite module is a very good starting point for your research, since it is very precise and offers really good examples. I suggest you start yourself. If you run into a specific issue with your code, _then_ is the time to ask here and post your code along with a description of what does not work as expected. – arkascha Oct 04 '15 at 08:35
  • possible duplicate of [.htaccess redirect to all IP's but mine](http://stackoverflow.com/questions/8985502/htaccess-redirect-to-all-ips-but-mine) – monkee Oct 04 '15 at 08:38
  • The problem is if I write something like below: `RewriteEngine On RewriteBase / RewriteCond %{REMOTE_HOST} !^xxx.xxx.xxx.xxx RewriteRule .* /coming-soon.html [R=302,L]` It just creates a loop. So how can I redirect all visits to the site to this file, without creating a loop? – Martin Pihl Oct 04 '15 at 10:14

1 Answers1

0

As mentioned in this question.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteRule index.php$ /teaser.php [R=301,L]
Community
  • 1
  • 1
monkee
  • 399
  • 2
  • 11