There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios boot browser bsod computer cpu crash css dell desktop driver dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware help please hijackthis hjt install internet internet explorer itunes javascript keyboard lan laptop malware monitor network networking openoffice outlook outlook 2003 outlook express password popups problem router screen seo slow sound sp3 spyware startup trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless word
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
get rid of file extension on html pages.


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
tex0gen's Avatar
Computer Specs
Member with 88 posts.
 
Join Date: Jun 2007
Experience: Advanced
14-May-2008, 01:47 PM #1
get rid of file extension on html pages.
Hey there, just wondering how i get rid of file extensions on my website so instead of it being "www.domain.com/home.html"
it always shows as "www.domain.com/"
no matter what page its on.
tomdkat's Avatar
Computer Specs
Distinguished Member with 2,968 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
14-May-2008, 02:26 PM #2
Those are two different things.

A) For the file extension to be removed, your URLs would be transformed from:

www.domain.com/home.html

to

www.domain.com/home

B) If you don't want the name of the actual file containing the currently viewed page to be displayed, you could load your site using traditional HTML frames and ALL of the pages will appear to be loaded from

www.domain.com

You could probably do the same using iframes, like we did in another thread on this forum. There are probably other options available as well that aren't coming to mind for me right now.

So, are you looking for 'A' or 'B' above?

Peace...
TroyTime's Avatar
Computer Specs
Junior Member with 12 posts.
 
Join Date: Apr 2008
Experience: programmer for 10 years, but new to vista
14-May-2008, 04:13 PM #3
if you're using apache, you can use mod_rewrite

to make domain.com/home.html into domain.com/home/, the rule would be:

RewriteEngine On
RewriteRule ^home/ home.html [L]

(that goes in .htaccess)

if you have a ton of files, you can use a regular expression and a single rule
but if its less than 10 pages you can just copy and edit that line
tomdkat's Avatar
Computer Specs
Distinguished Member with 2,968 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
14-May-2008, 04:24 PM #4
Quote:
Originally Posted by TroyTime View Post
if you're using apache, you can use mod_rewrite

to make domain.com/home.html into domain.com/home/, the rule would be:
That's changing the URL incorrectly, due to the trailing slash, right? Would the trailing slash be left off in the Rewrite rule if the OP use mod_rewrite?

Peace....
TroyTime's Avatar
Computer Specs
Junior Member with 12 posts.
 
Join Date: Apr 2008
Experience: programmer for 10 years, but new to vista
14-May-2008, 04:44 PM #5
the trailing slash can be optional

RewriteRule ^home/? home.html [L]
tomdkat's Avatar
Computer Specs
Distinguished Member with 2,968 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
14-May-2008, 04:48 PM #6
I mean www.domain.com/home/ is a completely different URL than www.domain.com/home (with the .html from home.html removed). That's why I questioned the trailing slash.

Peace...
tex0gen's Avatar
Computer Specs
Member with 88 posts.
 
Join Date: Jun 2007
Experience: Advanced
14-May-2008, 05:26 PM #7
id like it preferably to have just www.domain.com and no page name showing... you say use a frame? how would i go about using this?
tomdkat's Avatar
Computer Specs
Distinguished Member with 2,968 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
14-May-2008, 07:43 PM #8
If you wanted to use traditional HTML frames, I would start by learning what they are and how they work. There should be plenty of information on the web on frames. If you're using a tool like DreamWeaver, there should be info on frames in its online help.

Peace...
Mudley's Avatar
Computer Specs
Member with 99 posts.
 
Join Date: Apr 2008
Experience: Advanced
14-May-2008, 11:20 PM #9
my lord, frames



domain.com/home
and domain.com/home/ are the same
they will load the default file in the home directory
tomdkat's Avatar
Computer Specs
Distinguished Member with 2,968 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
14-May-2008, 11:43 PM #10
Quote:
Originally Posted by Mudley View Post
domain.com/home
and domain.com/home/ are the same
they will load the default file in the home directory
That is true and is exactly NOT what the OP was inquiring about above. That is why I inquired about the slash in the Rewrite rule.

Peace...
Mudley's Avatar
Computer Specs
Member with 99 posts.
 
Join Date: Apr 2008
Experience: Advanced
15-May-2008, 12:03 AM #11
you're right. i didn't even read the OP after it said "get rid of file extensions"

i can't imagine why anyone would want the url to ALWAYS be the same
that makes baby jesus cry
tex0gen's Avatar
Computer Specs
Member with 88 posts.
 
Join Date: Jun 2007
Experience: Advanced
15-May-2008, 06:56 AM #12
okay so you suggest i just get rid of the .html at the end? i think it looks naff like that. so how do i get rid of it? and no im not using apache. Im using freewebs.com but iv bought my own domain on it.
tomdkat's Avatar
Computer Specs
Distinguished Member with 2,968 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
15-May-2008, 10:04 AM #13
Quote:
Originally Posted by Mudley View Post
i can't imagine why anyone would want the url to ALWAYS be the same
that makes baby jesus cry


Quote:
Originally Posted by tex0gen View Post
okay so you suggest i just get rid of the .html at the end? i think it looks naff like that. so how do i get rid of it? and no im not using apache. Im using freewebs.com but iv bought my own domain on it.
At that point, we were just trying to figure out what you wanted. You've basically answered that question above and HTML frames is just one way of accomplishing that. Using iframes is another way of accomplishing that.

Peace...
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:36 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.