php - header redirect not working at all -


i have php file called init.php want load inc.php files (that contains html). structure of file.

define ("html", __dir__ . '/page/');  $page = !empty($_get['page']) ? $_get['page'] : 'index';  if (!file_exists(html . $page . '.inc.php'))     $page = 'index';   header('location: ' . html  . $page . '.inc.php'); 

for reason, redirection doesn't redirect place should redirect (localhost/page/index.inc.php)

any idea of happening there?

note i'm @ index.php in root directory , i've required_once init.php in same root directory.

location should uri, not file path!

header('location: /page/' . $page . '.inc.php'); 

__dir__ give directory of file being parsed (for example, /home/site/index.php. location header expecting uri (for example, /page/something.php), not file system path.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -