The code below shows an example of how to write to the htaccess file in PHP. The example below will write a new line at the bottom of your htaccess file. The htaccess file should be located in the same folder from which the PHP runs
The Code
1 2 3 4 5 |
<?php $f = fopen(".htaccess", "a+"); fwrite($f, "\n#This line added via php script"); fclose($f); ?> |