2

I want apache2 to host home.php or whatever I choose as the start page instead of index.html. Everything I have read says to edit the DirectoryIndex parameter of the httpd.conf file. I do not have that file anywhere. (I searched.)

I also did not have an .htaccess file by default. I created one and put the line DirectoryIndex home.php in it; I then restarted apache. Nothing chaged.

This is in my apache2.conf file.

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

I am not sure what Options Indexes FollowSymLinks does.

These are the file contents of my /var/www/html/.htaccess.

<Directory /var/www/html> DirectoryIndex home.php </Directory>

When I change AllowOverride to All I receive a server error.

Thanks.

3
  • You do not need to restart Apache when you set .htaccess files. Your directive DirectoryIndex home.php should work. Are you sure that AllowOverride in httpd.conf in set for this virtual host? Commented Apr 4, 2015 at 18:48
  • There is no httpd.conf Commented Apr 5, 2015 at 15:52
  • I solved this by replacing line Options Indexes FollowSymLinks with DirectoryIndex home.php. Commented Apr 5, 2015 at 16:39

1 Answer 1

3

The best way is to add DirectoryIndex to your vhost configuration.

<Directory /foo>
    DirectoryIndex home.php
    Allow Override All
</Directory>

When you want to use that option ins your .htaccess file you have to set AllowOverride All in your vhost configuration. Otherwise you should get an error in your log DirectoryIndex not allowed here.

Sign up to request clarification or add additional context in comments.

3 Comments

After playing around with it some more I can't fix it with what you are describing. I edited the original question with more info.
Like i described ;) set AllowOverride to All otherwise you .htaccess is not working.
;) check your logs but you get an error because now your .htaccess files are read and executed ;) so debug and fix it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.