Here is my root directory
dev (root folder)
| zones(folder)
| | index.php
| | new-zone.php
| | update-zone.php
index.php
login.php
signup.php
header.php
functions.php
outside of root folder I have config file called config.php
Now from header.php
page I am calling following code and it's working fine:
require_once('../config/config.php');
require_once('functions.php');
But now I need to call same header.php
file from the folder zones/index.php
page and it's code is bellow :
require_once("../header.php");
But showing following error message :
require_once(../config/config.php): failed to open stream: No such file or directory in D:\Softwares Installed\xampp-old\htdocs\aponit\dev\header.php on line 3
Fatal error: require_once(): Failed opening required '../config/config.php' (include_path='.;D:\Softwares Installed\xampp-old\php\PEAR\;D:\xampp\htdocs\smarty\libs\') in D:\Softwares Installed\xampp-old\htdocs\aponit\dev\header.php on line 3
How can I solve this error ? I want to call header.php
file from different folders ?
Note : I am using following .htaccess
rules to use SEO friendly url and custom error message page.
.htaccess code :
Options -MultiViews
ErrorDocument 404 http://localhost/aponit/dev/not-found.php
ErrorDocument 500 http://localhost/aponit/dev/404.php
RewriteEngine on
RewriteRule ^(?:zones/)?update-zone/(\w+)/?$ update-zone.php?z=$1 [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]