0 0 Votes

Absolute path of a web site on the web space?

Question by Chematik | 25/08/2013 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

Stefan Trost

Show Profile | Message
Avatar
0Best Answer
0 Votes

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

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

<?php
echo getcwd();
?>

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

<?php
phpinfo();
?>

where 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.
26/08/2013 at 02:17

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 articles on askingbox.com. How to do.