Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

My site, www.example.com has a MyBB forum installation, and has many users constantly checking it out. I would like to make a major change to it - basically, I want to delete everything it has and start clean.

However, this rebuilding process may take me hours since I need to do a lot of things. Thus, whenever an user tries to enter any part of my site (www.example.com, www.example.com/blog etc), the user will always be redirected to www.example.com/underconstruction so they can see a nice HTML site explaining the current situation.

But not only that - while I am configuring my site, I need to visit it myself to make sure things do work live. So basically, it has to redirect everyone who isn't me.

Is that possible in any way? I am using GoDaddy hosting.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Try using .htaccess!

# Turn on mod_rewrite 
RewriteEngine On

# If not your IP address 
RewriteCond %{REMOTE_ADDR} !^**\.**\.**\.**

# and not the temporary page 
RewriteCond %{REQUEST_URI} !^/maintenance\.

# redirect to temporary page 
RewriteRule /*$ /maintenance.php [L]

I think the above might help you a whole bunch!

share|improve this answer
    
It works. Thank you. –  Omega Dec 21 '12 at 1:26
    
@Omega No problem. Glad to be of service. –  Aaron May 23 '13 at 14:45

I'd make backups especially of your database if you are starting over. I'm sure you already will though.

To redirect everyone but yourself you can add this to your .htaccess file

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteRule /*$ /maintenance.php [R=301,L]

This will redirect all users except you to a maintenance.php page

share|improve this answer
    
Your RewriteRule only redirects users that access index.php, is that intentional? –  w3d Dec 16 '12 at 1:08

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.