zapppa — 2012-12-20T07:10:18-05:00 — #1
I have a site with around 30 pages. I would like users to be able to type in
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 ?
ralphm — 2012-12-20T07:26:28-05:00 — #2
The easiest thing to do is to let them type mysite.com/example/—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 mysite.com/example 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.
stevie_d — 2012-12-20T07:47:41-05:00 — #3
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.
picnictutorials — 2012-12-20T18:22:13-05:00 — #4
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
stevie_d — 2012-12-25T19:27:37-05:00 — #5
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.