I've got a site presently survive a website. I must switch it to an alternative site, that's presently inside a password protected sub directory about this server.

I've got a "Site Maintenance happening" page. I wish to set Apache therefore it shows that automatically rather than "index.php". Also, I would like anything else around the server to become password protected as i result in the switch (although that isn't essential, I suppose).

I added this towards the .htaccess file in public_html:

DirectoryIndex siteDown.php

Regrettably, this does not do anything whatsoever. I'm able to navigate to http://world wide web.example.com/siteDown.php all right.

I am on the hosting that is shared setup. Could that be considered a problem?

Shared hosts, routinely have a user interface of some kind, that enables you to definitely switch on .htaccess processing.

You need to use mod_rewrite rules, as Directory Index is only going to process records that finish as

http://world wide web.example.com/

http://world wide web.example.com/this%5Fother%5Fpage.html will still process fine, despite the fact that you might have modified DirectoryIndex.

Additionally, you should serve a 503 error, as moving bots, caches, along with other organizations may make an effort to cache that page as "being" your website.

Some shared hosts don't permit .htaccess. Look at your hosting's TOS to ascertain if they're permitted, or put some "garbage" (like "asdasdasd") inside your .htaccess. In case your page loads fine, then your server is not reading through them. If you achieve a internal server error (500) it's triggered.

Without having .htaccess enabled, you are able to perform a redirect using php. Within the first lines of the index.php:

header("Location: http://domain.com/siteDown.php")

exit()

It is not the very best solution available, however it works as intended. And when your site structure is definitely located in index.php querystrings (like index.php?page=home) it really works in most pages.

Why not add something towards the mind of the index.php page like:

if($site_lower == TRUE)

lower"



Then store your variable in where for the situation, like a database or flat file. Should you put this flag to your database you may also setup such things as scheduled maintenance and useful messages to become displayed. This works on any located account with MySQL and PHP and it is great if you want to seal lower. It's not necessary to move any files.

This is very rough pseudocode so don't copy, but this will highlight the concept:

$sql = "Choose * FROM site_maintenance WHERE lower_start >= NOW() AND lower_finish <= NOW() ORDER BY lower_start ASC, lower_finish ASC LIMIT 1"

// Get A RESULT SET

if( COUNT($result) == 1 )

Lower: "

    exit