Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Htaccess absolute path

Is it possible to get the absolut path to my ".htaccess" file?

Im using this to load init.php in every file.

php_value auto_prepend_file /Applications/XAMPP/xamppfiles/htdocs/init.php

Is there a way so I don't have to write the absolute path?

Like this, if init.php is in the same category as the .htaccess file:

php_value auto_prepend_file [ABSOLUTE_PATH_TO_HTACCESS]/init.php

and if that is possible, how do I write that but still go back one directory (Since init.php is outside public_html, where the .htaccess is).

Thanks in advance.

like image 228
Jacob Avatar asked Jul 22 '15 10:07

Jacob


1 Answers

Assuming the updated response on the accepted answer here works, and that your relative directory structure is as you describe:

[docroot]
 |
 \- init.php
 |
 \- public_html
     |
     \- .htaccess
     |
     \- index.php

then you should be able to go up one directory to the init.php file you wish to prepend by including the directive

php_value auto_prepend_file ./../init.php

in your .htaccess file.

like image 139
Benjamin Avatar answered Oct 25 '22 05:10

Benjamin