• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Best way to keep visitors away during installation?

RobParker

Well-known member
#1
I'm planning to move from VB to XF later today and wondered what the best way to keep visitors away during the installation?

Can I just use a .htaccess access file to stop them accessing my site at all?
 

RobParker

Well-known member
#3
I'm more worried what will happen as I'm deleting files and uploading the new ones, etc.

If I wanted to send anyone visiting my site to say my twitter page is that possible and how would I exit the .htaccess file to do that?
 

Jake Bunce

XenForo moderator
Staff member
#4
If I wanted to send anyone visiting my site to say my twitter page is that possible and how would I exit the .htaccess file to do that?
For example, this htaccess code will redirect everyone to twitter except for your IP address:

Code:
<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{REMOTE_ADDR} !^12\.34\.56\.78$
	RewriteRule ^.*$ http://www.twitter.com/ [R=302,L]
</IfModule>
Just enter your IP (which will not be redirected) and your twitter URL.
 
#5
You can use this code replacing 127.0.0.1 with your IP address and example.com with any chosen link to redirect all users there. Just add it to the your index.php

Code:
<?php $allow = array("127.0.0.1");
 
if(!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) {
 
    header("Location: http://www.example.com/");
 
    exit();
 
} ?>
 
#6
For example, this htaccess code will redirect everyone to twitter except for your IP address:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
 
RewriteCond %{REMOTE_ADDR} !^12\.34\.56\.78$
RewriteRule ^.*$ http://www.twitter.com/ [R=302,L]
</IfModule>
Just enter your IP (which will not be redirected) and your twitter URL.
How can I add multiple IP addresses?
 
#8
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
 
RewriteCond %{REMOTE_ADDR} !^12\.34\.56\.78$
RewriteCond %{REMOTE_ADDR} !^11\.22\.33\.44$
RewriteCond %{REMOTE_ADDR} !^44\.33\.22\.11$
RewriteRule ^.*$ http://www.twitter.com/ [R=302,L]
</IfModule>
I used this but it is not redirecting to it.