- Impact
- 9
Accesing a file in an upper directory
I am trying to access the .htaccess file from another folder, so for example from the admin folder i want to edit the root .htaccess file.
I have this but it doesn't seem to work.
I am trying to access the .htaccess file from another folder, so for example from the admin folder i want to edit the root .htaccess file.
PHP:
$current = file_get_contents('../.htaccess');
$current .= "\n RewriteRule ^". $url ." show.php?id=". $id;
$h = fopen('../.htaccess', 'w+');
fwrite($h, $current, filesize('../.htaccess'));
I have this but it doesn't seem to work.
Last edited:




