Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    83
    Thanks
    4
    Thanked 0 Times in 0 Posts

    removing .html tags

    I want to remove the ".html" tag in the address bar, so instead of someone typing in say, www.example.com/news.html they would just type www.example.com/news

    Kinda looked around but couldn't really find anything.

    Thanks!

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need to look into mod rewrite with htaccess.

    http://spindrop.us/2006/07/26/how-to...ons-from-urls/
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Jan 2008
    Posts
    37
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rickfink View Post
    I want to remove the ".html" tag in the address bar, so instead of someone typing in say, www.example.com/news.html they would just type www.example.com/news

    Kinda looked around but couldn't really find anything.

    Thanks!
    2 ways of achieving it:

    The easiest way is to create a directory called "news" in which your "news.html" file should be renamed to "index.html". The browser will take care of hiding the index file and all you will see is new/

    The hardest way is to use CMS and if you're on Apache, I recommend MODx CMS

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Here is another trick which use some htaccess rules only, http://eisabainyo.net/weblog/2007/08...-via-htaccess/
    Last edited by abduraooft; 05-12-2009 at 08:06 AM. Reason: typo
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    May 2008
    Location
    Oxford, UK
    Posts
    422
    Thanks
    14
    Thanked 27 Times in 27 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    You need to look into mod rewrite with htaccess.

    http://spindrop.us/2006/07/26/how-to...ons-from-urls/
    Probably worth pointing out that this is only a solution for folk using apache.

    If you're using IIS on a windows server you'll need to look into Rewrite Module for IIS

  • #6
    New Coder
    Join Date
    Jan 2009
    Posts
    83
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I did try using different directories but then don't you have to update all the links differently because of the different levels? Like say I wanted to do a find and replace with a link to all my pages. I wouldn't be able to do that because all the links would be different, right?

  • #7
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I wouldn't be able to do that because all the links would be different, right?
    If you use absolute paths starting with forward slashes everywhere, it'd not be so hard. Have a look at CSS, Div,Linking
    Last edited by abduraooft; 05-11-2009 at 01:34 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #8
    New Coder
    Join Date
    Jan 2009
    Posts
    83
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Here is another trick which only use some htaccess rules, http://eisabainyo.net/weblog/2007/08...-via-htaccess/
    This worked great thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •