I know that this has something to do with the .htaccess file that is found on the root of the server.
I am wondering how I can make visitors be re-directed temporarily to a page while my website goes under updating?
Re-directing using 301 looks too complicated for me and I don’t think it addresses what I am looking for as it seems like it is sending visitors to a completely new site i.e. domain
You do NOT want to use a 301 (permanent) redirection!!!
Personally, I simply change the DirectoryIndex to index.html (which will provide my “down for maintenance” message) while I work on index.php and other PHP scripts which will be unaffected.
If you want to keep others off your scripts while they’re being worked on (I’d recommend you do this with a test server - OFFLINE - instead), you can redirect EVERY request (R=302, i.e., temporary) to index.html EXCEPT for your own IP address, i.e.,
RewriteEngine on
RewriteCond %{REMOTE_ADDRESS} !^127\\.0\\.0\\.1$
RewriteRule !^index\\.html$ index.html [R=302,L]
Be sure to use YOUR IP Address, not 127.0.0.1 which is “localhost”, i.e., your computer.
dklynn is suggesting a method whereby anybody trying to visit your site will be automatically redirected to the temporary page.
But presumably you want to be able to view your “under-construction” site without being redirected. So to do that, you have to set the IP address of the computer you’re using to be an exception to the redirect rule. In other words “redirect everybody to this page, unless they’re visiting from this particular IP address”.
I am now having problems with a few links, though not all links while the site is being re-directed, i.e. maintenance mode
I keep getting “The page isn’t redirecting properly” (firefox), other browsers will come up with their own error messages, while testing site, this works well when on a localhost environment, but not on the remote server
the link goes to home.php but has ?key_word=art at the end
Meh, found the problem, me trying to be so smart and not using the old method of doing things, lol i.e. a script error thanks anyway for all your help in this matter