How to redirect to home from the directory level up? I have a registered user $login and an absolute path $root = $_SERVER['DOCUMENT_ROOT']; header("location: $root/$login"); - that's not how it works. .htaccess configured to redirect all requests to index.php
|
1 answer
http://ua2.php.net/manual/en/reserved.variables.server.php
$_SERVER['DOCUMENT_ROOT'] is not what you want. You are interested in $_SERVER['HTTP_HOST'] , if I correctly understood your question.
$host = $_SERVER['HTTP_HOST']; header("location: $host/$login"); - I need a redirect from the top directory,
$_SERVER['HTTP_HOST']pushes away from this directory - O.Vykhor - @ O.Vykhor, what does "redirect from the top directory" mean? nothing higher than the main one. For redirection, you can omit the host
header("location: /$login");- Marsel Arduanov
|
var_dump("location: $root/$login");which outputs. - Naumov