# get rid of file extension on html pages.



## tex0gen (Jun 10, 2007)

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 (May 6, 2006)

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 (Apr 7, 2008)

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 (May 6, 2006)

TroyTime said:


> 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 (Apr 7, 2008)

the trailing slash can be optional

RewriteRule ^home/? home.html [L]


----------



## tomdkat (May 6, 2006)

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 (Jun 10, 2007)

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 (May 6, 2006)

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 (Apr 7, 2008)

my lord, frames



domain.com/home
and domain.com/home/ are the same
they will load the default file in the home directory


----------



## tomdkat (May 6, 2006)

Mudley said:


> 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 (Apr 7, 2008)

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 (Jun 10, 2007)

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 (May 6, 2006)

Mudley said:


> i can't imagine why anyone would want the url to ALWAYS be the same
> that makes baby jesus cry






tex0gen said:


> 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...


----------

