Well, the following are just possible, untested ideas.
If you only want to remove a possible trailing slash (excepting for directories), I think you can use:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
Or, if you also wish to remove "www." from all URLs (another possibility for duplicates):
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)(/?)$ http://example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)(/?)$ http://example.com/$1/ [R=301,L]
If you had IRMs, probably adding this line (or other solution) would be necessary before each of those two RewriteRule:
Code:
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
Of course, write your domain instead of
example.
Since these are just untested suggestions, maybe others will indicate mistakes or better ways. Also, different situations (for example IROs, etc.) require different solutions. You may see
Apache 1.3 URL Rewriting Guide (FQuest is currently using that Apache version, I think).