HOME
How to change apache2 localhost location?

Follow the below steps to change apache2 localhost location:


First open up your terminal and go the follwing location using terminal

cd /etc/apache2/sites-available

Once you have navigated to the above mentioned location, will find 2 files in there

000-default.conf
default-ssl.conf

Open both files one after other and make the following changes. Replace the location to your new location

DocumentRoot /var/www/html

To (Insert the location where you want your apacheserver to be redirected)

DocumentRoot /home/user/Desktop/YourFolderName

After making the change, go a step back (back to apache folder)

cd ..

Or

cd /etc/apache2

Now open up apache config file and add the following lines

Directory /home/user/Desktop/YourFolderName Options Indexes FollowSymLinks
AllowOverride None
Require all granted
/Directory

Add the above lines right below

Directory /var/www/
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
/Directory

Now restart apache service with the following command

sudo service apache2 restart

You are good to go.

CONTACT ME

Feel free to contact me @

pavankumarpre@gmail.com

+91 701 309 1943