.htaccess for file extensions?

Discussion in 'HTML' started by draphael, Oct 30, 2005.

  1. draphael

    draphael Guest

    Hi,

    Is there a way to configure .htaccess so that requests for files ending in
    ..htm are redirected to the same file name but with an extension of .html?

    Requests for .htm pages are showing up in my error logs. The page name is
    right but the extension should be .html. I don't know where these are coming
    from, I'd rather that folks were directed to the correct page, rather than
    the 404 page.

    If it's possible I'd surely be grateful for the solution!

    Thanks!!
    DRaphael
    draphael, Oct 30, 2005
    #1
    1. Advertising

  2. draphael wrote:
    > Hi,
    >
    > Is there a way to configure .htaccess so that requests for files ending in
    > .htm are redirected to the same file name but with an extension of .html?


    Use mod_rewrite or the simpler mod_alias.

    I have very little experience with either, but I guess this
    should work:
    RedirectMatch permanent ^(.*)\.htm$ $1.html
    Mitja Trampus, Oct 30, 2005
    #2
    1. Advertising

  3. draphael

    draphael Guest

    "Mitja Trampus" <> wrote in message
    news:3N89f.1003$...
    > draphael wrote:
    >> Hi,
    >>
    >> Is there a way to configure .htaccess so that requests for files ending
    >> in .htm are redirected to the same file name but with an extension of
    >> .html?

    >
    > Use mod_rewrite or the simpler mod_alias.
    >
    > I have very little experience with either, but I guess this should work:
    > RedirectMatch permanent ^(.*)\.htm$ $1.html


    worked like a charm! thanks so much!

    best,
    DRaphael
    draphael, Oct 30, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stoco

    .htaccess and perl cgi

    Stoco, Jan 12, 2004, in forum: Perl
    Replies:
    0
    Views:
    2,842
    Stoco
    Jan 12, 2004
  2. Replies:
    7
    Views:
    598
    Matt Clara
    Jan 18, 2006
  3. Nospam
    Replies:
    3
    Views:
    689
    David Dorward
    Aug 15, 2006
  4. Leif K-Brooks

    redirect to a php file from htaccess

    Leif K-Brooks, Sep 28, 2006, in forum: HTML
    Replies:
    15
    Views:
    914
    Nospam
    Sep 29, 2006
  5. Mark Shapiro

    htaccess file help please

    Mark Shapiro, Mar 4, 2011, in forum: HTML
    Replies:
    10
    Views:
    813
    Denis McMahon
    Mar 8, 2011
Loading...

Share This Page