I’m just working on a new design for my portfolio and would like some advice on how to remove the file extension from my pages (e.g. .asp, .html etc) and replace them with something more SEO-friendly (e.g. /portfolio.html to /website-design-portfolio).
If anyone has any ideas how I could go about doing this I’d really appreciate it!
to your .htaccess file, it will allow you to miss off file extensions. So if you ask for website.com/file and there’s a page at website.com/file.php it will redirect you to that. (If you have multiple files with the same name but different filetypes then this can go horribly pear-shaped and you would need to use a more rigorous re-write approach.)
In terms of renaming the files, why would you want to replace a name that is short, easy to remember, easy to type and nicely tweetable, with one that is none of those? I really don’t get this current fetish for cramming half a paragraph into the URL, and I’ve not seen any real evidence that it makes a tangible difference to performance in search engines.
But if you really feel you have to go down that route, you’ll need to set up individual re-writes for each file. If you use a CMS then it might have an option to do that, but otherwise it’s pretty straightforward. If you’re keeping the file name as it is now and just using the long name as an alias then for each page, just add a line like this to your .htaccess file:
I consider MultiViews to be a major problem because it can pick a part of a filename out of a path and deliver unanticipated content. From Apache.org, there can be other problems (AddType and DirectoryIndex):
Shox,
You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.