The document root directory under which the current script is executing, as defined in the server's configuration file.
Questions tagged [document-root]
341 questions
2
votes
2 answers
Absolute path with header location
abspath()
function abspath()
{
echo $_SERVER['DOCUMENT_ROOT'];
}
directory()
function directory()
{
echo '/folder/';
}
Code Line:-
header('Location:'.abspath().directory());
Gives me the following as output:
C:/xampp/htdocs/folder/
When…

Django Anonymous
- 2,987
- 16
- 58
- 106
2
votes
3 answers
DOCUMENT_ROOT is not complete, missing domain folder
I have searched many threads so far but cant seem to find a solution. Inside one of my php scripts I am trying to get a server document root but the value I get is not complete, its simply missing the domain folder. I believe it is due to sharing…

devjs11
- 1,898
- 7
- 43
- 73
2
votes
2 answers
What is the equivalent of PHP's $_SERVER['DOCUMENT_ROOT'] in Java
I need to know the Java equivalent of PHP's $_SERVER['DOCUMENT_ROOT'].
I am writing a Java backend program that will take an uploaded image as a byte[] and save the image to the server where my Java program is running. Then I want to send the image…

tribal
- 653
- 2
- 13
- 26
2
votes
1 answer
Redirect all existent and non-existent pages and folders within subfolder to one page when custom DocumentRoot set
I have the next file structure:
.htaccess
index.php
public/
├─ v1/
│ ├─ .htaccess
│ ├─ index.php
├─ index.php
I've set document root on server level to public subfolder in order to remove it from url.
I need all the requests containing v1 in url…

Acidon
- 1,294
- 4
- 23
- 44
2
votes
1 answer
$_SERVER['DOCUMENT_ROOT'] does not work in command-line PHP. How do I fix this?
I am able to access the PHP page in the web browser without error and works. (error display active)
But when I want to access the PHP page via SSH I get some errors.
PHP Warning: include_once(/app/config.php): failed to open stream: No such file or…
user12799634
2
votes
1 answer
Substitute for $DOCUMENT_ROOT without register_globals?
I have a website (hand-coded HTML/CSS/PHP) with many hundreds of pages, each with multiple references to $DOCUMENT_ROOT - for example:
Under PHP 5 that worked fine, but register_globals has been…

nerdfever.com
- 1,652
- 1
- 20
- 41
2
votes
0 answers
DocumentRoot and VSCode intelephense
How can I set the Workspace in Visual Studio Code so that the "intelephense" mechanism will suggest me the autocompletion for paths starting from the directory that I use as DocumentRoot (Apache), instead of starting from the VS Code Workspace…

nomaddev
- 21
- 4
2
votes
2 answers
form action="/login"? What does the slash mean?
form action="/login" autocomplete="on" method="POST" class="Form__TBkbl6WYB9WAqzg-uU2EE"
I expected to see something like login.php or some other PHP file.
What does the / mean?
Is this some form of security measure?

bundleOfSticks
- 21
- 2
2
votes
3 answers
Is it possible to set the filesystem root and/or the document root to some subdirectory of the filesystem?
I would like to know if it is possible to specify a subdirectory for the filesystem root or the document root for requests of static resources (if there's any such distinction) in node.js.
I know that I can do it by concatenating an absolute path…

user113716
- 318,772
- 63
- 451
- 440
2
votes
0 answers
Pointing xampp to public folder / different folder for only one project
I use xampp and have a project where I need to point/configure the server to a different root directory (public in this case) and I do it by going to
xampp > Apache > Config > httpd.conf
find this
DocumentRoot "C:/xampp/htdocs"

Manish Bathla
- 21
- 3
2
votes
2 answers
AS3: Really weird "inaccessable" error when referencing document root object
Alright, I am pulling my hair out on this one. Got this problem at around 9 last night and was up until 5 trying to fix it, and then all day so far (it's already about 9 PM again) trying to fix it. I've tried everything I can think of.
Alright, so…

Qix - MONICA WAS MISTREATED
- 14,451
- 16
- 82
- 145
2
votes
0 answers
PHP document root and require
I am about to use an old software I wrote when I had very little knowledge about PHP and now I have a lot of:
require("/path/file.php");
that do not work anymore because $_SERVER['DOCUMENT_ROOT'] has changed from "/" to "/htdocs/web/". Is there…

silentheaven
- 51
- 6
2
votes
1 answer
passing root path in move_uploaded_file
i have a constant variable named SADMIN
define('SADMIN','http://localhost/synthesis_study_material/student_admin/');
and i am trying to use SADMIN constant in my move_uploaded_file function
move_uploaded_file($_FILES['name']['tmp_name'],…

vivek modi
- 487
- 1
- 5
- 19
2
votes
0 answers
Redirecting with sub-domain
I have about 5 apps I want to host on a server. The main entry server will sit on the main domain while others will be sub.
sudo vi /etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html/mainapp
I pointed the document root to the…

ken4ward
- 2,246
- 5
- 49
- 89
2
votes
2 answers
Is it possible to have multiple .htaccess files for the same application?
I have two domains having same document root. As per the requirement, I want both the domains should have their own .htaccess file. Is their any way with whom I can achieve this?

Mia
- 49
- 1
- 5