This might work for your situation:
Modify .htaccess to see the following:
RewriteEngine On RewriteBase / # redirect mapped domain ReWriteCond %{HTTP_HOST} joshblease.uk.to ReWriteCond %{REQUEST_URI} !gme-index/ ReWriteRule ^(.*)$ gme-index/$1 [L] ###CUSTOM RULES###
PHP script, assuming $ rules contains new changed rules,
$htaccess = file_get_contents('/path/to/.htaccess'); $htaccess = str_replace('###CUSTOM RULES###', $rules."\n###CUSTOM RULES###", $htaccess); file_put_contents('/path/to/.htaccess', $htaccess);
the example above is a theory and has not been tested, depends on .htaccess and script access rights.
source share