how to configuring a xampp web server for different root directory
So the question is when i install and set up xampp my web directory is:
and I want to set it up for:
How to do it?
Now when I type in my browser the address:
and I want to type in my browser the address:
Verified Answer (104 Votes) ✓
You can change Apaches httpd.conf by clicking (in xampp control panel)
apache/conf/httpd.conf and adjust the entries for
DocumentRoot and the corresponding
Just Ctrl+F for "htdocs" and change the entries to your new path.
Answer #2 (34 Votes)
- Go to C:\xampp\apache\conf\httpd.conf
- Open httpd.conf
- Find tag : DocumentRoot "C:/xampp/htdocs"
- Edit tag to : DocumentRoot "C:/xampp/htdocs/myproject/web"
Now find tag and change it to < Directory "C:/xampp/htdocs/myproject/web" >
Restart Your Apache
Answer #3 (12 Votes)
In case, if anyone prefers a simpler solution, especially on Linux (e.g. Ubuntu), a very easy way out is to create a symbolic link to the intended folder in the htdocs folder. For example, if I want to be able to serve files from a folder called "/home/some/projects/testserver/" and my htdocs is located in "/opt/lampp/htdocs/". Just create a symbolic link like so:
ln -s /home/some/projects/testserver /opt/lampp/htdocs/testserver
The command for symbolic link works like so:
ln -s target source
target - The existing file/directory you would like to link TO. source - The file/folder to be created, copying the contents of the target. The LINK itself.
For more help see ln --help Source: Create Symbolic Links in Ubuntu
And that's done. just visit http://localhost/testserver/ In fact, you don't even need to restart your server.