homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
.htaccess - Redirect everyone but my IP
I need to update my site and close it for an hour
GameX




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

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]

 

txbakers




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

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.

ScottM




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

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....)

GameX




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

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.

GameX




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

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?

marcs




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

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.

GameX




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

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...]

jdMorgan




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

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

DaveAtIFG




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

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.

GameX




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

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?

jdMorgan




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

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

ggrot




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

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.

GameX




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved