Using fopen to modify the htaccess file
Posted: Thu May 25, 2006 10:02 pm
Hello
Anyone have any suggestions on how to modify the htaccess file using fopen Here is my short piece of code that should open and modify the access file but it does not work I am assuming that the page is running as the wrong user to modify the file (hence NOBODY). I am wondering how I can change this section of code so I can modify this file automatically.
Thanks for any Input;
Devain
Anyone have any suggestions on how to modify the htaccess file using fopen Here is my short piece of code that should open and modify the access file but it does not work I am assuming that the page is running as the wrong user to modify the file (hence NOBODY). I am wondering how I can change this section of code so I can modify this file automatically.
Code: Select all
$ourFileNameAccess = "/home/USERNAME/public_html/.htaccess";
$fh2 = fopen($ourFileNameAccess, 'a') or die("can't open file");
$stringData2 = "RewriteRule ^([^/]+)/$toplevel_name.hml$ MainTemplate/$toplevel_name.php?menu=$1\n\n\n";
fwrite($fh2, $stringData2);
fclose($fh2);Thanks for any Input;
Devain