Is it possible to have a single .htaccess file for both localhost and online
Unfortunately I have Googled and not been able to find a solution so...
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
I would prefer a single .htaccess file that detects HOST and performs relevant script
I struggle with Apache's htaccess and have a hard job in trying to find the relevant
information in the wealth of free advice :(
With PHP this is a simple task:
# PHP eqivalent to Apache .htaccess file
defined('LOCALHOST') ? NULL : define('LOCALHOST', in_array($_SERVER['SERVER_NAME'], array('localhost', '127.0.0.1') ));
# condition for specific host
if( LOCALHOST )
# Read somewhere that not availalble in Apache
else # if( ! LOCALHOST )
ErrorDocument 404 /404.php