...

View Full Version : removing .html tags



rickfink
05-10-2009, 07:21 PM
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!

_Aerospace_Eng_
05-10-2009, 07:31 PM
You need to look into mod rewrite with htaccess.

http://spindrop.us/2006/07/26/how-to-remove-file-extensions-from-urls/

treigh
05-10-2009, 07:41 PM
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 (http://www.modxcms.com)

abduraooft
05-11-2009, 10:18 AM
Here is another trick which use some htaccess rules only, http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess/

brazenskies
05-11-2009, 12:27 PM
You need to look into mod rewrite with htaccess.

http://spindrop.us/2006/07/26/how-to-remove-file-extensions-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 (http://learn.iis.net/page.aspx/460/using-url-rewrite-module/)

rickfink
05-11-2009, 02:23 PM
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?

abduraooft
05-11-2009, 02:28 PM
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 http://www.codingforums.com/showpost.php?p=784167&postcount=9

rickfink
05-12-2009, 05:18 AM
Here is another trick which only use some htaccess rules, http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess/

This worked great thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum