PDA

View Full Version : .htm ?



brokenmachine
04-08-2008, 02:03 PM
Hello you lot,

I'm making a website for the band but on pages it says: www.brokenmachine.co.uk/gigs.htm


(not online yet though)

how can i make the webpage www.brokenmachine.co.uk/gigs without the extension code bit?

Thank You.

Marc J
04-08-2008, 02:37 PM
The easy way is to name the page in question index.htm, and place it in a folder at www.brokenmachine.co.uk/gigs/

The more complicated way would be using mod rewrite and htaccess to serve the correct page. See http://newmediarts.blogspot.com/2007/01/hide-file-extensions-in-urls-with.html for a pointer.

P.S. It's a good idea to register your domain before posting anything like this, as there are people around who would register it before you do....

brokenmachine
04-08-2008, 02:40 PM
The first one seems simple but what do you mean?

Sorry

Marc J
04-08-2008, 02:55 PM
The first one seems simple but what do you mean?

Sorry

Your website can have a folder (or directory) structure just like files on your PC. In a website, there are default files which will show if no filename is used, for example typing www.brokenmachine.co.uk will actually show the file www.brokenmachine.co.uk/index.htm as index.htm is almost always included in the default file list on the server. FYI this list is usually something like: -

index.html
index.shtml
index.php
index.htm
default.html
Default.htm
default.html
Default.html
default.shtml
Default.shtml
page1.html
index.pl
index.cgi
index.php3
index.phtml
home.htm
home.html
home.shtml
index.wml

Although not particularly in that order. What this means is that when the server gets a request for a folder but no file name, it will look for the above files and display the first match it finds. There are ways to customise this default file list using htaccess but you probably don't want to go there....

So, if you have gigs.htm and you want it to display without the .htm, you rename it index.htm and put it in the \gigs\ folder.

brokenmachine
04-08-2008, 03:37 PM
Thanks, I think thats cleared that up, so my file directory will be like this?:

Broken Machine - Template folder
gig - folder\ gig.htm
music - folder\ ---
video - folder\ ---

Is this correct and if so i will just need to type in: www.brokenmachine.co.uk/gig and that webpage will load up?

And is this what I could use for .htaccess if I sometime in the future need to: www.htaccesseditor.com/en.shtml#a_redirect

Marc J
04-08-2008, 03:46 PM
Thanks, I think thats cleared that up, so my file directory will be like this?:

Broken Machine - Template folder
gig - folder\ gig.htm
music - folder\ ---
video - folder\ ---

Is this correct and if so i will just need to type in: www.brokenmachine.co.uk/gig and that webpage will load up?
No, it'll be like this: -

Broken Machine - Template folder
gig - folder\ index.htm
music - folder\ index.htm
video - folder\ index.htm


And is this what I could use for .htaccess if I sometime in the future need to: www.htaccesseditor.com/en.shtml#a_redirect
No, I wouldn't use that.

brokenmachine
04-08-2008, 03:48 PM
So with that file structure when someone for example types in: www.brokenmachine.co.uk/gig it will load the gig page and for the other pages as well? /music etc etc

Marc J
04-08-2008, 04:24 PM
So with that file structure when someone for example types in: www.brokenmachine.co.uk/gig it will load the gig page and for the other pages as well? /music etc etc

Yes, should do. Just remember to code the pages correctly as links between the pages would have to reflect the directory structure, for example a link from the music page to the gig page would look something like: -

<a href="../gig/index.htm">click here to go to the Gig page</a>

The ../gig/ part meaning "go back one, then into the gig directory".