akshay Posted April 20, 2010 Share Posted April 20, 2010 Hello. I was wondering in case I've to switch my site to "maintenance mode", what do I do either with PHP / .htaccess such that any page browsed on my site say http://mysite.web/dir/file.ext redirects to http://mysite.web/maintainence.php or simply /index.php ? Because, for sure I'm not going to edit each page / directory and add header code. I just want to redirect the visitor to "under maintenance" page or home page (that reads "under maintenance") when he/she accesses any page/directory. Thank you Akshay Link to comment https://forums.phpfreaks.com/topic/199142-redirecting-to-home-indexphp-when-any-page-is-accessed/ Share on other sites More sharing options...
Ken2k7 Posted April 20, 2010 Share Posted April 20, 2010 I would use .htaccess. http://www.webweaver.nu/html-tips/web-redirection.shtml Link to comment https://forums.phpfreaks.com/topic/199142-redirecting-to-home-indexphp-when-any-page-is-accessed/#findComment-1045154 Share on other sites More sharing options...
dotMoe Posted April 20, 2010 Share Posted April 20, 2010 The quickest way I do a redirect is on the page i want to direct away from I use: header("location: ./index"); Link to comment https://forums.phpfreaks.com/topic/199142-redirecting-to-home-indexphp-when-any-page-is-accessed/#findComment-1045208 Share on other sites More sharing options...
Ken2k7 Posted April 20, 2010 Share Posted April 20, 2010 The quickest way I do a redirect is on the page i want to direct away from I use: header("location: ./index"); You would do that on every page? Link to comment https://forums.phpfreaks.com/topic/199142-redirecting-to-home-indexphp-when-any-page-is-accessed/#findComment-1045209 Share on other sites More sharing options...
dotMoe Posted April 20, 2010 Share Posted April 20, 2010 I misread it. I thought A page Link to comment https://forums.phpfreaks.com/topic/199142-redirecting-to-home-indexphp-when-any-page-is-accessed/#findComment-1045331 Share on other sites More sharing options...
NTSmarkv Posted April 20, 2010 Share Posted April 20, 2010 just use header()... example: Header("Location: index.php"); anytime you have that on a page. it will always redirect you, so if you have a main header.php on your site add near top under session. Bam your done, when your done updating to go back live just comment it out. Link to comment https://forums.phpfreaks.com/topic/199142-redirecting-to-home-indexphp-when-any-page-is-accessed/#findComment-1045335 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.