Hi All,
Unfortunately I have Googled and not been able to find a solution so...
Problem:
Two different .htaccess files required for http://localhost and http://MySite.com
Having to maintain two different .htaccess files with the same name.
Try to prevent renaming and uploading incorrect .htaccess files
Requirements:
I would prefer a single .htaccess file that detects HOST and performs relevant script
Reason:
I struggle with Apache's htaccess and have a hard job in trying to find the relevant
information in the wealth of free advice 
Solution:
With PHP this is a simple task:
# PHP eqivalent to Apache .htaccess file
PHP Code:
#test host
defined('LOCALHOST') ? NULL : define('LOCALHOST', in_array($_SERVER['SERVER_NAME'], array('localhost', '127.0.0.1') ));
# condition for specific host
if( LOCALHOST )
{
include 'htaccess-for-localhost.php';
# Read somewhere that not availalble in Apache
}
else # if( ! LOCALHOST )
{
include 'htaccess-for-MySite.php';
}
#Common stuff
ErrorDocument 404 /404.php
Bookmarks