Include directory path in .htaccess

In my .htaccess file

php_value auto_append_file "run_me_first.php"

Because I want to run it before any other file. Now it works, if run_me_first.phpthey foo.phpare in the same directory, but as soon as I do something like going to the directory, it gives me this error(include_path='.:/usr/share/php:/usr/share/pear')

root
|_ .htaccess
|_ run_me_first.php
|_ foo.php
|_ folder1
   |_ bar.php // If I try to access this, give me the error above.

Any idea?

+4
source share
1 answer

You can set the full path associated with your root folder to make your rule directory recursive. You can see the path on your cPanel or use the php function getcwd()in run_me_first.php.

In my case, the path would be like this:

php_value auto_append_file "/home/userID/public_html/run_me_first.php"

. ( ), auto_prepend_file.

+1

Source: https://habr.com/ru/post/1527065/


All Articles