Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

trailing slashes in URLs tracked separately

shokk
Third-Party Pepper Developer
Posted on May 04, '07 at 09:38 am

I’ve noticed that some of the URLs being tracked by Mint come up as http://www.site.com/blah/yadda/ while others come up as http://www.site.com/blah/yadda without the trailing slash. Both lead to the same page, but Mint is tracking them differently. Is there any way to have Mint ignore or trim the trailing slash, maybe with a preference like we now have for trimming www?

Shaun Inman
Mint/Pepper Developer
Posted on May 04, '07 at 12:48 pm

No. This is really a server or CMS level problem. The trim www/index.php preference was designed primarily for referrers—where you have no control over the the url structure.

There should be a way to enforce your preferred url structure using .htaccess.

Ronald Heft
Third-Party Pepper Developer
Posted on May 04, '07 at 12:54 pm

Give this .htaccess rule try. It will force a trailing slash on all URLs which are not files:

# Force Trailing Slash
RewriteCond %{REQUEST_URI} ^/[^.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]

If you use WordPress, just make sure the rule is before the WordPress rewrites.

shokk
Third-Party Pepper Developer
Posted on May 04, '07 at 08:37 pm

Right, I figured it wouldn’t hurt to ask. ;) That does the trick, Ronald. Thanks. I’ll wait for my stats to readjust over the week.

You must be logged in to reply. Login above or create an account