Default domain file name query

I recently began converting one of my websites from .html to .php.

Originally my default page was home.html. I renamed this file home.php. When I searched for my domain, I would get the “Forbidden … 403” error message. This evening I changed the default page to index.php and for some reason I no longer get the 403 error webpage.

I think I picked up the (bad?) habit on naming the default page “home.html” when I began using RapidWeaver years ago. I now realize that it is probably best practice to use index rather than home for the default webpage title. That said, I am shocked that renaming the default page to index eliminated the error message. I think I recall reading somewhere that default webpages beginning with “index” are searched for first when opening domains on the 'net, but I could be wrong.

Does this make sense to anyone?

I was ready to begin tweaking my .htaccess file to redirect to the new default page, but that no longer seems to be necessary. I anyone can shed some light on this I would be most grateful.

Thank you!

If your server is Apache2 then DirectoryIndex command which sets the order of the default web page. The command may also be set in the .htaccess file:

File: .htaccess

DirectoryIndex  FRED.HTML index.php index.html results.php 

Setting the above will instruct Apache to first look for a web-page named FRED.HTML. If there is no match then the other file names will be tried. If there is no match then depending on other directives an index of all the files in the folder will be displayed or an 404 error message will display stating the files could not be displayed.

BEWARE:

Upon reflection it is not as simple as just setting DirectoryIndex in the .htaccess file, there are numerous other factors which need to be taken into consideration!

Thank you for the info. I am not certain at this moment if my server is Apache2 or not, but I will check.

I appreciate your help.

It’s Apache:

Thanks for the info. I sincerely appreciate your help.

1 Like

Are you sure about that? :thinking:

3 Likes

Although Nginx is similar to Apache in many respects, it doesn’t use .htaccess

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.