I have a static web page that I need to turn off, I don't want to delete the file though because there is a good chance I will need to turn it back on in the future. How can I do this?
Thanks!
I have a static web page that I need to turn off, I don't want to delete the file though because there is a good chance I will need to turn it back on in the future. How can I do this?
Thanks!
Rename / move it to a filename/folder that the web server will not serve (good point Richard)
If you want the page to no longer be served, why not just rename it to file.html.disabled
or something? When you want to continue serving it again, rename it back?
You can use an .htaccess file to redirect it:
rewriteengine on
rewriterule ^static-page.html$ relocate-here.html [L]
You should be having it in your source control(?) then remove it and add it when you need it. Or Rename it as Rob said.
If the page you are wanting to temporarily 'hide' is a php page, you could do something like this at the top of that php file you want to 'hide'.
<?php
header('Location: http://www.example.com/not_available.html');
die();
?>
Just replace the url after Location:
to a placeholder page of your choosing.
There are other HTTP header tricks you could do, like returning a 404, 503, etc.
http://phpweby.com/tutorials/php/35
You could also use the .htaccess trick suggested by @andrew-g-johnson, using the .htaccess file shouldn't have much of an impact performance wise, especially compared to doing it inside PHP.