PDA

View Full Version : Redirecting all pages to one


CanHasPotato
10-22-2009, 02:07 AM
So whenever I need to close my site for maintenance, is it possible for every page but the page being redirected to to redirect to a page. Sorry if its confusing, but it would be like:
if ($url = '/(.*)' && $url !== '/redirectedto.php') {
// redirect to /redirectedto.php
}
else {
// do nothing since they are already at the page
}

Also, is it possible to not redirect only for a few IPs?

if ($url = '/(.*)' && $url !== '/redirectedto.php' && $ip !== '71.178.x.xx' ) {
// redirect to /redirectedto.php
}
else {
// do nothing since they are already at the page
}

Blaher
10-22-2009, 05:04 PM
This would be more appropriate in php, but check out http://php.net/manual/en/reserved.variables.server.php

Use $_SERVER[PHP_SELF] (unless you're using mod_rewrite) for the url and $_SERVER[REMOTE_ADDR] for the ip.

CanHasPotato
10-22-2009, 08:39 PM
This would be more appropriate in php, but check out http://php.net/manual/en/reserved.variables.server.php

Use $_SERVER[PHP_SELF] (unless you're using mod_rewrite) for the url and $_SERVER[REMOTE_ADDR] for the ip.

I was going to, but was looking for an easier way then updating every page. Thanks though!

Blaher
10-24-2009, 12:49 PM
This might work then.


AuthName "Under Construction"
AuthType Basic
<Limit GET POST>
order deny,allow
deny from all
allow from 456.789.1.23
allow from 274.246.76.
</Limit>
Then I would make a error page for the users who get restricted and have it say what ever you want.