When I go to my website an index of all the files shows up, when I choose a specific page the html isn't able to access the images in a file. How can I make Apache2 automatically launch /var/www/home.html instead of /var/www?
You can use DirectoryIndex directive in vitual host context.
From apache website
The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name.
Here's the example:
<virtualhost *:80>
ServerName domain.com
ServerAlias www.domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex home.html index.html
DocumentRoot /var/www
</virtualhost>
In Apache2, specifying DirectoryIndex
directive inside virtualhost
tag of sites-available/default
configuration file didn't work for me. Instead, placing DirectoryIndex
directive inside Directory
tag of apache2.conf
file as mentioned in http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex did exactly what we want.
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