Hi,

I have the following rule that works well to remove trailing slashes from URLs:

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

This is done to prevent the non-slash URL from being treated as duplicate content with the URL with a slash.

The problem is that there are exceptions, such as when we want to add query strings to the end of a URL:

https://example.com/administrator/path/?cms_settings

I've also tried a variation, like:

https://example.com/administrator/path?cms_settings

but somehow the slash is replaced back into the URL and I don't know where it comes from.

Adding index.php to the path works properly because it's then not a directory:

https://example.com/administrator/path/index.php?cms_settings

Any ideas greatly appreciated.

Thanks,
Dave

Reply via email to