Msg#: 4269725 posted 9:30 am on Feb 20, 2011 (gmt 0)
Sorry if this is an obvious question - but I've been searching online for ages, without getting an answer to it.
I've got a simple bit of mod rewrite code in my htaccess file, which removes the file extension from the URL.
This all works great if you directly type in the file name without the extension - the page displays with the extensionless file name in the address bar
BUT - if you follow a link to the page on my website, the extension is still displayed - obviously, this is because the file name extension is present in the HTML source code of the link.
Clearly, one solution to this is to remove all the extensions from my links - easy enough to do, but that means that all the links are broken when I am viewing the site locally in Dreamweaver preview mode.
So my question is - do I HAVE to remove the extension from all my links, or is there a mod rewrite code that will display an extensionless URL even if the extension is left in the links?
Msg#: 4269725 posted 10:55 am on Feb 20, 2011 (gmt 0)
Links "define" URLs, so the links must point to the URLs that you want users to "see" and "use".
The act of clicking the link sends a URL request to the server. It is too late to "change" that URL after the click.
One other thing. In order to remove Duplicate Content issues from your site, you should set up a 301 redirect such that if <anything>.html is requested, the user is redirected to www.example.com/<anything>.
All of the redirect and rewrite code should use RewriteRule directives and the external redirects must be listed before the internal rewrites.
Finally, set up a local copy of Apache on a PC or laptop in order to view your site offline.