Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jul 2005
    Posts
    609

    Default How can I make pages load regardless if .htm or .html is called?

    How can I make pages load regardless if .htm or .html is called?

    I have page new.htm, I want that to come up whether someone types in new.htm or new.html

    Can that be set in cpanel?

  2. #2
    Member sawbuck's Avatar
    Join Date
    Jan 2004
    Posts
    1,313
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Assume you have tested and it's not working?

    It should work by default as .htm/.html fuctionality is normally included in the DirectoryIndex statement in httpd.conf.

  3. #3
    Member
    Join Date
    Oct 2001
    Posts
    651

    Default

    Quote Originally Posted by sawbuck
    Assume you have tested and it's not working?

    It should work by default as .htm/.html fuctionality is normally included in the DirectoryIndex statement in httpd.conf.
    That is not what the op means. He means if somebody calls for www.domain.com/new.html but new.html does not exist and new.htm does exist, is there a way to get he webserver to display the contents of new.htm automatically when there is a 404 error on new.html.
    Marty Hoskins
    TLC Web Enterprises

  4. #4
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    The best long term option would be to design all URLs to not be specific to the format of the document.

    For example, instead of having http://www.example.com/new.html, have http://www.example.com/new/index.html, which to the user would only need to be http://www.example.com/new/, therefore helping to both reduce the chance of the user mis-typing a URL and increase the chance of the user remembering the URL.

    Furthermore, URLs of the form http://www.example.com/new/index.html could then be changed, if needed, to http://www.example.com/new/index.php without needing to change any links - more forwards compatible.

    However such a suggestion is not a solution to the specific problem at hand, nevertheless it helps minimise the risk of such problems occurring and so I thought it worth mentioning.

  5. #5
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Oct 2003
    Posts
    1,931

    Default

    a simple .htaccess file will do the trick

    Options +FollowSymlinks
    rewriteengine on
    rewriterule ^(.*)\.htm$ http://yourdomain.com/$1.html [r=301,nc]

    the above asumes that you have all html files and want all htm to go to there corisponding html files reverse the code if you want it to go the other way


    warning with the above example if you have working htm files it will redirect them to html if they do not exist 404
    Lowest Host/Empire Technology LLC
    Affordable hosting solutions http://empire-hosting.net
    List Your hosting site FREE in http://hostgeneration.com

Similar Threads & Tags
Similar threads

  1. Allow PHP in Htm and HTML pages
    By cmwh in forum cPanel and WHM Discussions
    Replies: 29
    Last Post: 06-20-2009, 04:59 AM
  2. Word to HTM and to HTML? How?
    By wimour in forum New User Questions
    Replies: 1
    Last Post: 05-11-2008, 01:49 PM
  3. Which page do you want to load first index.html or index.htm?
    By BianchiDude in forum cPanel and WHM Discussions
    Replies: 22
    Last Post: 04-10-2008, 09:36 AM
  4. How do I make .htm files parse as php
    By denisdekat09 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 01-11-2008, 10:40 AM
  5. addpop.htm & adpop2.html
    By manokiss in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-09-2002, 06:31 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube