Forum Moderators: phranque
I'm trying to write a redirect script to put up briefly while I'm doing some routine maintenance on my site. I want to redirect all visitors except for me to a "Routine Maintenance" notice. I'm assuming I'll need to use .htaccess to redirect all but my IP to the notice page, but I don't know how to use IP conditionals in .htaccess.
The second step will be handling the page requests from visitors other than me. The .htaccess file will have redirected them to a PHP script. I want that to show them the URL of the page they were trying to reach, then provide a form where they can enter their e-mail address to be notified when the page becomes available. I can handle all this scripting, except determining what the original request was. I tried using the $REQUEST_URI variable, but it always returns as the URL for the page the .htaccess file redirected me to. I need some way of grabbing the URL for the page the visitor wanted to go to before .htaccess sent them somewhere else.
If anyone can shed some light on these questions, I will be most grateful!
Thanks,
Matthew
To do this, I use Firefox and it's user-agent string thingy (extension) and setup a UAS that only I would dream up.
At that point you can use your htaccess or a php script to redirect everyone but you.
So, lets say you set up in Firefox a UA of 'MatthewHSE'. Then in PHP you would have a:
if($_SERVER['HTTP_USER_AGENT'] == "MatthewHSE") {
// do nothing
}
else {
// redirect here
location("");
}
I'm pretty sure that I've done the same thing via an htaccess file...