Apache apparently has a server module call mod_negotiation which contains an option called MultiViews. MultiViews is a setting that gives the server the ability to decide the best representation for a requested file that doesn’t exist.
Furthermore, If MultiViews is enabled on the server, it will take operational precedence before any mod_rewrite directives that you provide in your .htaccess files. Had I been aware of this setting being turned on by default with my host, I would have requested for them to turn if off. However, I was completely oblivious that the setting even existed.
The Apache documentation states …
MultiViews is a per-directory option, meaning it can be set with an Options directive within a , or section in httpd.conf, or (if AllowOverride is properly set) in .htaccess files. Note that Options All does not set MultiViews; you have to ask for it by name.
The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client’s requirements.
MultiViews may also apply to searches for the file named by the DirectoryIndex directive, if the server is trying to index a directory. If the configuration files specify
DirectoryIndexindex, then the server will arbitrate between index.html and index.html3 if both are present. If neither are present, and index.cgi is there, the server will run it.
If one of the files found when reading the directory does not have an extension recognized by mod_mime to designate its Charset, Content-Type, Language, or Encoding, then the result depends on the setting of the MultiViewsMatch directive. This directive determines whether handlers, filters, and other extension types can participate in MultiViews negotiation.
MultiViews ~ I should have known
My issue with MultiViews was discovered after a WordPress installation went south. I had installed WP 2.7 with a theme that I created and a group of plug-ins which I typically use. After creating a page for the HTML sitemap, I browsed the URL to make sure everything was working correctly. The destination URL was www.website.com/sitemap/, yet when I browsed to the page, the server was re-writing the URL as www.website.com/sitemap.xml/ which incidentally did not exist.
Now, I also had Arne Brachold’s Google Sitemap Generator for WordPress installed and I figured that there must be something wrong with either my .htaccess files or his sitemap plug-in on WP 2.7. After uninstalling his plug-in and several others in an attempt to solve the mysterious problem, checking and re-checking my .htaccess files, re-installing WordPress several times and arguing with my host that I have exhausted practically all efforts … I became quite irritated. It was only when one of the tech support guys that had some experience with Apache realized the issue and sent me an e-mail informing me that the issue was due to MultiViews being enabled on the server. He suggested that I should have had requested to have it turned off … I should have known.
Woe to you … on shared hosting
If you are on shared hosting, you may not even know that some shared hosting accounts come equipped with the mod_negotiation module activated by default. If you are using the Apache2handler and want to find out yourself, just create a .php file with phpinfo(); in it and run that … you should be able see if the mod_negotiation module is loaded … If you are using the CGI/FastCGI such as I am, I don’t know how you can tell … phpinfo(); doesn’t reveal those settings … for the record contact your host.
SEO Side Effects » Duplicate Content with MutiViews
After doing some research and about MutiViews, I found a thread on WebMasterWorld stating that there may be duplicate content issues from using the MultiViews as well. Apparently MutiViews will allow for multiple URL’s to point to the same content …
If you are having issues with duplicate content … or if you can’t seem to get your mod_rewrite directives to work as expected, you may want to take a look at the fantastic article in WebMasterWorld by: JDMorgan “A guide to fixing duplicate content & URL issues on Apache” …
|Reference:||Apache MultiViews & Mod_Rewrite from our SCG partner Edward Beckett at the Design Develop Deliver blog.|