TL;DR: What does the following line of code do? Does it remove trailing slashes from a URL?
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L]
I inherited a Drupal site with little knowledge of how htaccess files work.
We have a folder, let's call it "culture" in our document root. In the culture folder we have a index.html file. So that's docroot/culture/index.html.
In my browser, when I try to go to www.mysitename.com/culture I get a infinite redirect. After using an online redirect checker I found that the following is happening:
http://www.mysitename.com/culture/ 301 Moved Permanently http://www.mysitename.com/culture 301 Moved Permanently ...
The trailing slash (the real monster here) is added and removed back and forth 19 times and this is what the error says specifically:
Too many redirects. Please try to reduce your number of redirects. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.
Alas, I believe I found the issue to be this line of code:
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L]
I comment this line of code and the redirect no longer occurs. However, in the comments for the htaccess it's stated that this line I commented out is used to remove trailing slashes on our pages -- though the trailing slashes are still being removed without it.
Any thoughts on what this line of code does?