themistral Posted May 15, 2012 Share Posted May 15, 2012 Hi guys, I need some help with a redirect. I currently have the following to add a trailing slash to the end of my URL. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^(.*)/$ RewriteCond %{REQUEST_URI} !^(.*).(css|CSS|js|JS|png|PNG|jpg|JPG|jpeg|JPEG|gif|GIF|zip|ZIP|xml|XML|pdf|PDF|html|HTML|php|PHP|txt|TXT)$ RewriteRule ^(.*)$ /$1/ [QSA,R=301,L] This works fine. However, when using the google UTM code appended to the homepage, the URL breaks, so I need to remove the trailing slash. I've tried a number of things but nothing is working. Can anyone advise how I exclude the homepage in the above code? I was thinking RewriteCond %{REQUEST_URI} !^$ but that's not working Quote Link to comment https://forums.phpfreaks.com/topic/262561-exclude-root-domain-from-trailing-slash-code/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.