Url Format: How do I have page links without extension at the end?

Hi

I have a site with around 30 pages. I would like users to be able to type in

www.mysite.com/example

At the moment to get to this page my users would have to type www.mysite.com/example.php

How would I make this feature ?

The easiest thing to do is to let them type [noparse]mysite.com/example/[/noparse]—that is, with a slash on the end. You do this by creating a folder inside your root folder called /example/ and moving the example.php file to that folder and renaming it as index.php.

An alternative is to rewrite your URLs with a .htaccess rule, but that’s a little tricker and messier … although it means you don’t have to restructure your site.

Often sites have a structure like [noparse]mysite.com/example[/noparse] because their pages are served up by a CMS that creates such URLs by default. But rebuilding your site within a CMS is most likely the most time consuming option.

Or just turn on ‘multiviews’ in .htaccess, which means that (as long as there is no other file or folder with the same name) you can leave off the file extensions and it will figure out what page you want and take you to it automatically.

That’s cool. But wouldn’t that create Canonicalization. Aka redundant content. Like www and no www - like site.com/index.php and just site.com

[font=verdana]If you only ever reference the non-extension format of the URL then that’s all that should ever appear. Failing that, you can simply add a canonical link into the <head> giving the preferred URL format.

The problem with using a visible rewrite is that search engines will genuinely use the actual URL rather than the alias URL (in this case, they would normally prefer the URL with extension), whereas if you’re trying to promote your site then you are likely to want to prefer the non-extension format.[/font]