How to Remove the .html at the End of a Webpage?

Discussion in 'HTML & Website Design' started by Jordan642, Jun 4, 2010.

  1. #1
    How do you remove the .html in the website url. For example http://example.com/webpage.html. Most websites that I see don't have the .html extension on their webpages so I was wondering how I can do it for my website.

    Thanks,
    Jordan
     
    Jordan642, Jun 4, 2010 IP
  2. aeroz1

    aeroz1 Active Member

    Messages:
    492
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    to deploy extensionless URLs:
    1) Edit your pages (or your page-generation script) to link to extensionless URLs
    2) Add mod_rewrite code to internally rewrite those URLs, when requested from your server, to the correct-extension file.
    3) Optional: Detect client requests for URLs with extensions, and externally redirect those to the extensionless URL. the purpose of this is to 'recover' old backlinks and user bookmarks, and to speed up the switchover to your extensionless URLs in search engine results.

    So basically, you're trying to do step 3 here without doing the other two steps. This will result in your visitors having to go through the added delay of an external redirect for every extensionless page request, and complicate the search engines' job of indexing those pages.
     
    aeroz1, Jun 4, 2010 IP
  3. joshvelco

    joshvelco Peon

    Messages:
    819
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If the webpage.html is your main page, then change its' name to index.html, then when you just got to example.com it will come up without any page extension.
     
    joshvelco, Jun 4, 2010 IP
  4. Jordan642

    Jordan642 Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok. what is the mod_rewrite code?
     
    Jordan642, Jun 4, 2010 IP
  5. Jordan642

    Jordan642 Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I mean the other pages not the index file :)
     
    Jordan642, Jun 4, 2010 IP
  6. bavington

    bavington Peon

    Messages:
    74
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    An easier way than using the complicated MOD_REWRITE method is to simply save and organise your work into folders. For example, if you have a page called 'contact.php' and you would prefer 'contact/' instead, simply create a sub folder, and save the file inside as index.php.
     
    bavington, Jun 4, 2010 IP
  7. Jordan642

    Jordan642 Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok thanks for your help!
     
    Jordan642, Jun 4, 2010 IP
  8. dcristo

    dcristo Illustrious Member

    Messages:
    19,797
    Likes Received:
    1,201
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    5
    #8
    There is not much point in rewriting the URL's just to change to file extension, it's not better for seo.
     
    dcristo, Jun 4, 2010 IP
  9. krookpit

    krookpit Guest

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    The website you are talking about are having sub-directories.
     
    krookpit, Jun 4, 2010 IP