Search code examples
regexapache.htaccessmod-rewritedrupal-6

Remove Trailing slash from the domain name of the site in drupal 6


I am facing 1 problem on my live site.

I am working on the Drupal 6 and its a multilingual site. I have URL like : www.sitename.com/fr and www.sitename.com this two URL for both the languages.

Now when some one write www.sitename.com/fr/ in the address bar of browser it will redirect to the same www.sitename.com/fr/ instead of www.sitename.com/fr.

As we all know this affect a lot for ranking of the site.

Please help me.


Solution

  • Place this rule to remove trailing slash before all other rules in your root .htaccess:

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+?)/$ $1 [R=301,L]