homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Direct Apache to send #*$!.htm IF #*$!.html does not exist.

 2:38 pm on Nov 13, 2011 (gmt 0)

How should I go about directing Apache to send "example.htm" is "example.html" does not exist?




 3:40 pm on Nov 13, 2011 (gmt 0)

I figured it out. It's more simple than I was thinking. There's an option MultiViews which looks for the best match to a file.


 5:37 pm on Nov 13, 2011 (gmt 0)

That opens up your site to an infinite amount of duplicate content issues.

You should instead install a 301 redirect. Code for that is posted at least once per day in this forum.


 9:42 pm on Nov 13, 2011 (gmt 0)

It's almost exactly the same principle as redirecting with-or-without www. to your preferred format. If you really have a significant number of people aiming for the wrong extension, add a general \.html to \.htm redirect. And, as with all other generic redirects, make sure your own links-- and any others that you have control over-- are correct.


 9:56 pm on Nov 13, 2011 (gmt 0)

Another approach is to go without extensions altogether... that way only allowed will be processed.


 12:28 am on Nov 14, 2011 (gmt 0)

:) I knew someone would suggest that-- but here we seem to be talking about pages that already exist, so you wouldn't exactly be saving yourself any trouble. More work in fact, since you first have to do a redirect to put existing links into the new format, and then a rewrite to fetch contact from where it really lives.

But then, my automatic reaction to an extensionless url is to tell it to go put some clothes on ;)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved