00 Votes

Absolute path of a web site on the web space?

Question by Chematik | 2013-08-25 at 21:01

I am trying to create a protected directory on my webspace with the help of an .htaccess file. However, at the moment, I do not know how to proceed, because the server apparently cannot find the file .htuser that is necessary for the user and password information.

On the internet, I have read, that you have to specify the absolute path to the .htuser file on your web space in the .htaccess file to make it work.

But how can I determine the absolute path on my webspace? Can I read that out somewhere?

ReplyPositiveNegative
1Best Answer1 Vote

There are several ways to determine the absolute path on your webspace.

Simply create an arbitrary text filesuch as "path.php" with one of the following contents and invoke it on your webspace. With

<?php
echo getcwd();
?>

you can directly output the absolute path. More information provides the phpinfo function

<?php
phpinfo();
?>

with whitch you can find the absolute path under DOCUMENT_ROOT in the section Enviroment. With

<?php
echo $_SERVER['DOCUMENT_ROOT'];
?>

you can also directly access to this variable.

All of these functions are returning the absolute path to the place from which the script was called or the place where you have stored the file with the script on your webspace.
Last update on 2020-08-21 | Created on 2013-08-26

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.