-2
How do I point to the root directory without needing me to put index.php in the links and without using the .htaccess
?
Example:
<a href="index.php" class="nav-brand"><img src="logo.png" alt="Logo" /></a>
In the example above, the logo that appears on all pages has the link pointing to the main page and I wanted to point without having to call index.php on the link, has some way to do this without having to use the .htaccess
?
Have you tried using the
$_SERVER['DOCUMENT_ROOT']
?– Taffarel Xavier
@Taffarelxavier No, but this global variable is dependent on Apache is not ? She’s not so recommended for certain things, I could use her in case of link pointing ?
– Rooh Macedo
According to this answer, yes: https://stackoverflow.com/questions/13394924/php-serverdocument-root
– Taffarel Xavier
Machado, what’s the source? Because, according to the official website, there are comments with expressive votes with the use of it: https://www.php.net/manual/en/reserved.variables.server.php#112425
– Taffarel Xavier