PHP Using PHP Variables in .htaccess My solution to using PHP variables in the .htaccess file was to create a htaccess.php file which would write the .htaccess file whenever needed. htaccess.php