Browser Not Recognizing .html Files Without Extension

I’m a public interest lawyer and law professor rather than a computer professional, so I need help on what I thought would be a very simple problem.

I have had several websites up for more than a dozen years. In each case, and under half a dozen different Internet providers, if someone typed into their browser the name of a file in a directory or subdirectory without a .html at the end, the server would nevertheless deliver the proper file.
a request for would bring up
a request for wold return

Now, suddenly, upon switching to a new IP, requests for files without the .html extension result in a “404 file not found” message, but adding the extension produces the proper file.

In an attempt to cure this problem, I added an .htaccess file to my root directory which reads:
Options +Indexes
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes

However, adding this file does nothing to cure the problem. Although my IP support claims that there is no solution, I don’t see why it can’t be cured with a proper .htaccess file.

Perhaps the file I uploaded isn’t worded properly; maybe it has to be put somewhere else; maybe I have to put some line of code in the apache file or directory so that the system will properly act upon my .htacess file, or there is some other problem I don’t understand.


I would appreciate any help I can get, and the clearer the better. Thanks!

The behavior you want is not the default behavior of a web server. Having said that you need to add instructions to the .htaccess file that add this functionality: take the URL part after the first / and serve a matching file with an .html extension. What you have in your .htaccess does not attempt to do that.

The manual for the appropriate module is Apache Module mod_rewrite

Thank you for your prompt response. I am trying to do just what you say: add instructions to my .htaccess file which says “take the URL part after the first / and serve a matching file with an .html extension.” Indeed, I thought that’s why my modified .htaccess file did - but it doesn’t.

Actually, I think what I really need is to take the URL part after the LAST / and serve a matching file with an .html extension since I want this to work with a file in a subdirectory also. So I want the filename at the very end of a string to be served up as a .html file, even if it does not contain an .html extension.

So could you or another reader possible be so kind as to provide me with a copy of the code necessary to accomplish that end. I did try to read the manual you were kind enough to cite, as well as several documents referenced by it, but none seemed to be directly on point, or at least clear enough for me to follow. Thanking everyone in advance, . . .!

I don’t have a recipe ready to hand, but I will warn you that serving up identical content from multiple URLs may have a negative influence on search engine ranking (as you’re conceptually trying to sprinkle the same amount of “Google juice” across more pages). This isn’t to say that using .html-free URLs is necessarily bad - it’s just important to pick one standard (“canonical”) URL for all your pages and try to make sure that other equivalent URLs, if any exist, redirect to the main URL rather than just displaying the same data.

Try this instead.

Options +Indexes +MultiViews
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml

And the corresponding documentation is here: Content Negotiation - Negotiation in Apache

Thanks, Atropos7 for all your help, but unfortunately I’m still stuck.

I copied the code you very kindly provided, put it into Notepad, labeled the resulting document htaccess.txt (with no period before the h), and uploaded it to my main directory with my FTP.

Then, using the FTP, I changed the name of the file to .htaccess (with an initial period and no .txt at the end). This didn’t work, as a request for filename still yielded a 404 message, while a request for filename.html yielded the correct file.

I then put the same .htaccess file into the subdirectory, but this likewise didn’t help.

Anyone have any ideas?