rewrite rule to convert .htm to .html

Discussion in 'Apache' started by Omzy, Jun 14, 2010.

  1. #1
    I currently use the following rule to rewrite .php to .htm

    RewriteRule ^(.*)\.htm$ $1.php

    I now want to change this so that it rewrites .php to .html but also redirects any existing .htm urls to .html (search engine friendly redirect).
     
    Omzy, Jun 14, 2010 IP
  2. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    31 views and no reply?
     
    Omzy, Jun 14, 2010 IP
  3. infogle

    infogle Prominent Member

    Messages:
    2,732
    Likes Received:
    128
    Best Answers:
    1
    Trophy Points:
    300
    #3
    If i am not wrong you just need to add 'l' to your script like the following

    RewriteRule ^(.*)\.html$ $1.php

    i hope this will rename it to .html

    do let me know it is works....
     
    infogle, Jun 14, 2010 IP
  4. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeah that will change it .html, but how can I also ensure existing .htm links that have been indexed by Google are redirected to .html in the proper way?
     
    Omzy, Jun 14, 2010 IP
  5. infogle

    infogle Prominent Member

    Messages:
    2,732
    Likes Received:
    128
    Best Answers:
    1
    Trophy Points:
    300
    #5
    I am surely google will automatically pick this up... in some time or you can submit a XML sitemap to google for instant change notification
     
    infogle, Jun 14, 2010 IP