Shortening URLs with mod_rewrite
By Paul
4.29/5 based on 7 votes. The median rating is .
By Paul
If you're on an Apache server, or a Windows IIS server with ISAPI Rewrite or another mod_rewrite compatiable facility, you can make your categories accessible by a simple yoursite.com/wsnkb/catname/ url (where catname is any category name), article comments accesible by yoursite.com/wsnkb/thread/thread-name-1.html, and so on. This has the advantage of being friendlier-looking to the user, and it can put keywords in your URL which get you a better search engine rank.
To activate this option, simply go to Admin Panel -> Settings -> SEO and select to turn on url rewriting. If you've suppied your FTP info (at Settings -> System) everything from here should be handled automatically.
About the profile name rewriting option, please note: to do those rewrites, member names names must not contain special characters and must not be purely numeric. The registration page will automatically prevent illegal username registrations once you turn this on. This means it's only useful on English-language sites where people won't have accented or non-latin usernames.
Note:
Troubleshooting:
Recovery:
If you turn on rewriting but it doesn't work for whatever reason, you'll see an internal server error on your site. Delete your .htaccess file, then go to the SEO settings and turn rewriting off (or fix the issue).
To activate this option, simply go to Admin Panel -> Settings -> SEO and select to turn on url rewriting. If you've suppied your FTP info (at Settings -> System) everything from here should be handled automatically.
About the profile name rewriting option, please note: to do those rewrites, member names names must not contain special characters and must not be purely numeric. The registration page will automatically prevent illegal username registrations once you turn this on. This means it's only useful on English-language sites where people won't have accented or non-latin usernames.
Note:
- When a category name contains a special character it cannot use name rewriting, since that's not a legal character for URLs. It'll fall back automatically on numeric rewriting for that category.
- When you change the name of a category while using the category name URL rewriting, you'll need to regenerate categories before the subcategories list will update.
- If you have other directories besides 'admin' beneth WSN Links that you'll need to access, or you've named your admin directory something other than admin, you may need to add htaccess rules or use the advanced option to manually alter your htaccess. See http://www.webmastersite.net/forums/comments.php?....
Troubleshooting:
- Subcategory URLs, last thread profile urls and the like are cached, and so when you change your rewriting they don't update until you regenerate.
- If you've purposely blanked out one of the rewrite scheme boxes on the SEO settings page, that will kill everything. You must have a rewrite scheme in each box.
- Some odd web hosts require that you remove the index Follow Sym Links line from the htaccess file.
]*] The "Use top level category as subdomain?" option requires DNS wildcards, to have all subdomains redirected to your main (www) domain. You may need to talk to your web host to get this set up properly.
Recovery:
If you turn on rewriting but it doesn't work for whatever reason, you'll see an internal server error on your site. Delete your .htaccess file, then go to the SEO settings and turn rewriting off (or fix the issue).
Rating:
4.29/5 based on 7 votes. The median rating is .
Submitted: 09/30/03 (Edited 10/10/08)
Description: Details on how anyone running on an Apache web server can get keywords into URLs for SEO purposes.
Views:
5693 views. Averaging 3 per day.
In the most recent 30 day period, there've been 10 views.

Print
E-Mail