Xampp Change Document Root

change Apache document root in XAMPP

You can get this work by setting apache virtual host at locally as describe below:

For example in ubuntu /etc/apache2/httpd.conf,
If you are using XAMPP on window that is the case, then the httpd.conf file should be C:\xampp\apache\conf\httpd.conf.

Please follow below steps to configure your local sites at local server:

------------
Step 1
------------
i.e
<VirtualHost *:80>
ServerName test.demo.tst ( Any name you want to set )
DocumentRoot "C:/xampp/htdocs/bf"
<Directory "C:/xampp/htdocs/bf">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
#RackEnv development
ErrorLog C:/xampp/htdocs/bf/logs/test.demo.tst_error
CustomLog C:/xampp/htdocs/bf/logs/test.demo.tst_access common
</VirtualHost>

------------
Step 2
------------
Than you need to restart apache service

------------
Step 3
------------
Than you need to do setting in your hosts files
for example in hosts file place below entry

127.0.0.1 test.demo.tst

------------
Step 4
------------
Than you can access this url test.demo.tst local server.

I hope this informations would be helpful to you.

how to configuring a xampp web server for different root directory

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 Directory entry.
Just Ctrl+F for "htdocs" and change the entries to your new path.

See screenshot:

XAMPP config

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">

Changing DocumentRoot on XAMPP on Windows 10 causes Error 403

As it turns out, I was trying to access the server on https. http://localhost worked just fine. To make it work on HTTPS, apart from the httpd.conf, I also had to edit the http-ssl.conf:

<VirtualHost _default_:443>
DocumentRoot "C:/your-directory"


Related Topics



Leave a reply



Submit