I installed Apache2 on Ubuntu and put everything in /var/www/html for my linked domain name. Is this where its supposed to be on Apache 2? Its the only place that its been working for me…
But how do I stop my domain (typing in domain.tld) from automatically going to domain.tld/html/? The website displays ok but can’t I just get it to show the contents of the html file (and their subdirectories) and show domain.tld?
I have tried some .htaccess fixes but to no avail. I also have some code in my .htaccess which redirects http:// to https:// and that is at least working now.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
It only seems to be an issue when www. is in front of the address; otherwise it doesn’t redirect. Maybe its because of the ServerName, ServerAlias combo I used?
If your VirtualHost’s DocumentRoot is set to /var/www, you will need to set it to /var/www/html so that http://yourdomain.tld/ maps to /var/www/html instead of /var/www.
Open your VirtualHost file in nano:
sudo nano /etc/apache2/sites-enabled/virtual-host
and set DocumentRoot to /var/www/html.
Then restart Apache:
sudo service apache2 restart
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.