I have a site that the root points to /var/www I have set up two folders under /var/www
for the old folder, I have used the following to deny any access:
touch /var/www/old/.htaccess && echo deny from all >> /var/www/old/.htaccess
I now want the server to point the root to /var/www/new so that when people visit http://example.com the content in /var/www/new will serve, what should I do?
On Ubuntu, the Apache web server serves documents stored in the var/www/html directory by default. This directory is referred to as the document root.
If we have a multiple site which configured and enabled in the Virtual Host of the Apache, we can search for the document root in the /etc/apache2/sites-enabled folder.
All the configuration files for Apache are located in /etc/httpd/conf and /etc/httpd/conf.
The document root is a directory (a folder) that is stored on your host's servers and that is designated for holding web pages.
In Ubuntu the Apache configuration is located at /etc/apache2. There should be two folders, sites-available and sites-enabled. Inside sites-enabled are symlinks to config files in sites-available.
You simply have to change the document root in your activated configuration. Thats probably /etc/apache2/sites-enabled/000-default
Have a look for DocumentRoot and change it to /var/www/new, then reload your apache.
depends a LOT on how your apache server is configured.
I don't have an Ubuntu machine around, but what you're looking for is the DocumentRoot directive. On RedHat based machines it's normally in /etc/httpd/conf/httpd.conf but if memory serves Debian based systems use apache instead of httpd.
If that doesn't work be sure to check in /etc/httpd/conf.d since the files there are loaded dynamically.
Hope this helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With