Jump to content

Redirecting to home (index.php) when any page is accessed.


akshay

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.