I have been asked an interesting question by a client:
Can you create a url that doesn’t end in “.html” ?
It seems they’ve made a printed mailer piece and left off the file extention, so if someone types in the address i.e. www.domainname.com/pagename (and leaves off the .html) they need that user to be able to get to the page www.domainname.com/pagename.html, possibly with some kind of redirect.
There are probably more than 100 ways to do that. Here goes one of the easiest ones: create a “pagename/index.html” page. The web server will find the directory at the url and try to load the index page.
Other solutions will depend on your platform. For example, if you are running Apache with mod_redirect, you can add the folowing line to .htaccess:
This is also useful if you decide to change the technology used for instance if you ever wanted to change the .html to .php in order to use PHP in your pages you won’t have to update the links etc…
That would require a lot of folders. Simply linking to files without the extension will give the same benefits, without having a complicated folder structure. Furthermore, as I recall, Google does not consider example.com/folder and example.com/folder/ as the same page, leading to pagerank dillution.
all of those use index.php, i removed the .php and nothing was found. They are all hosted on different servers as well, none that I have tried find it without the extension!
Stormrider,
That’s because the site owners put on their servers files called index.php or index.html!
Christian meant that the site owner puts a file called index without specifying the extension!
Chrisitian, I agree that the directories technique has some disadvantages but it has some advantages too especially if the web site ain’t huge
Oh I see what you mean now. Sorry, misunderstanding! I thought he meant that you can just knock the extension off the request url and it would still work
It wouldn’t work for php files though, unless they were set up to run through the php engine. Normally only .php, .phtml etc files are parsed.
For Apache servers, it’s standard that you can just omit the extension, and it’ll work, regardless of whether the file has an extension or not (though files with the same name but different extensions can obviously create conflicts). Other servers have to have it specified in its settings.
DT
Yes, for a small page, it wouldn’t be much of a concern (and might even be favourable, under some circumstances), but I wouldn’t want it for a page with hundreds of pages.
The reason I didn’t suggest just removing the extension is that some servers won’t set the right content-type in the header, even though most will serve the html page just fine.
thank you one and all. Problem solved!
I just created a folder and named it for the page and then put an index page in it that was the page I wanted it to be and …presto!
R