A particular site had VBulletin installed within a sub-folder (/forums/) and it had a problem with parsing URLs. The following chunk of code was the contents of the .htaccess file. What it did was to redirect all non-www URLs to their respective URLs with www. appended to the front of the URL.
Options +FollowSymLinks
RewriteEngine On# This redirects non-www to www
RewriteCond %{SERVER_NAME} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/forums/$1 [L,R=301]
Specifically, forum posts and categories and what-not were fine, e.g.:
http://www.yourdomain.com/forums/category-one
http://www.yourdomain.com/forums/sample-post.php
However, if you tried to access http://www.yourdomain.com/forums/, Apache would act up and give you a weird-looking URL, resulting in an error 404 page.
Turns out that the addition of the following line is a conditional statement that tells Apache to skip the rule for anything that ends with a slash.
RewriteCond $1 !^/
The resultant .htaccess code:
Options +FollowSymLinks
RewriteEngine On# This redirects non-www to www
RewriteCond %{SERVER_NAME} ^yourdomain.com [NC]
RewriteCond $1 !^/
RewriteRule ^(.*)$ http://www.yourdomain.com/forums/$1 [L,R=301]
[template id="7325"]
Other Stuff