Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: Ocean10000 & incrediBILL & phranque

.htaccess - Redirect everyone but my IP

I need to update my site and close it for an hour

   
8:31 pm on Apr 16, 2003 (gmt 0)

10+ Year Member



I want to close my site down to perform some upgrades. This is the first time I have even attempted to do anything with the htaccess file. It took me a while to figure this out:

RedirectMatch .*\.php$ http://www.mysite.com/maintenance.htm

Then I realized I cannot view the pages! Is there a way that I can allow my IP to see the page but redirect everyone to a 'maintenance in progress'page? I am pretty sure there is a way, just dont know how

Also, if I ban someones IP address, can it be bypassed by an anonymous browsing site like http://anonsite.net/ww?

Thanks in advance,
Joe

[edited by: jatar_k at 8:54 pm (utc) on April 16, 2003]
[edit reason] generalized url [/edit]

9:14 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi Joe, welcome to the WebmasterWorld.

I would never, ever, ever shut down the entire site for longer than you absolutely need to.

If maintenance involves the server, that's different. But if you are making modifications to web pages, there is no need to shut down the site while doing this.

You can rename your inner pages and work on those while leaving up the original pages, or just put up a splash pace with no links for as short a time as possible.

9:18 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree, I make live changes all the time. Leave it up.

In fact, it may generate some 'odd interest'. (Did you see that? This picture just moved from here to there....)

9:46 pm on Apr 16, 2003 (gmt 0)

10+ Year Member



I am only going to close a single directory. I am going to be making some major changes to a messeage board. Could you possibly tell me how to do it anyway?

I want to shut it down because if the fourm causes errors, I will get many notifications about them.

3:06 am on Apr 17, 2003 (gmt 0)

10+ Year Member



I have found this, and the place I got it from said it will deny access to everyone except the person whos IP address is listed:

<Limit GET POST>
order deny,allow
deny from all
allow from 199.166.210.
</Limit>

But how would I redirect all of the denied people to another page?

3:28 am on Apr 17, 2003 (gmt 0)

10+ Year Member



But how would I redirect all of the denied people to another page?

Those who are denied access would be served a 403 error.

Add a custom page to handle that error to send them to the page of your choice. Do this in your .htaccess page.

ErrorDocument 403 /yourpage.html

Not that is still not a good idea for search engine bots, but it should do what you want.

10:55 am on Apr 17, 2003 (gmt 0)

10+ Year Member



Ok, thanks, but what about the other question:

If I ban someones IP address, can it be bypassed by an anonymous browsing site like [anonsite.net...]

4:35 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



GameX,

Redirect all requesting IP addresses except 123.45.67.89 to an alternate page using Apache mod_rewrite:


Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89
RewriteRule \.html$ /alternate_page.html [R=302,L]

This is a 302-Moved Temporarily redirect, since you are planning to remove it when you are finished updating.

For further study: Introduction to mod_rewrite [webmasterworld.com]

HTH,
Jim

9:19 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I ban someones IP address, can it be bypassed by an anonymous browsing site

Of course. An anonymous browsing site will have a unique IP and a properly functioning anonymizer only discloses it's own IP.

9:25 pm on Apr 17, 2003 (gmt 0)

10+ Year Member



Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST}!^123\.45\.67\.89
RewriteRule \.html$ /alternate_page.html [R=302,L]

That works if the url is [mysite.com...] but if I use the URL [forum.mysite.com,...] it goes into an infinite loop. How do I stop that?

9:41 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Blagh!

Sorry - Saw your question unanswered for a day, and thought I'd just dash one off!

Exclude the alternate page from rediriecting:


Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89
RewriteCond %{REQUEST_URI} !/alternate_page\.html$
RewriteRule \.html$ /alternate_page.html [R=302,L]

Jim

12:41 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you own the server, a better thing to do is set up a second domain with the same ip (like maintenance.mydomain.com), add a password file to it in apache, and then make an exact file copy. Work on this file set whenever you feel comfortable, and then when you have a working version, recopy it to the 'production' domain.

At least this is what I do.

3:15 am on Apr 18, 2003 (gmt 0)

10+ Year Member



Thank you all so much! I appreciate all of your help.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month