I have been fussing around with this .htaccess problem for a while and welcome any ideas on it.
I am redirecting all pages on the site to have a trailing slash. Which I thought was working fine, but when posting a link with a trailing slash on Facebook, instead of showing the little link preview it says: 301 Moved Permanently. Links without the trailing slash are fine. I used the Facebook dev link debugger and it says there is a circular redirect and it ends without a trailing slash.
I also have a rewrite forcing www and forcing https and getting rid of the index.php. Something in there is causing the circle. I have moved stuff around and tried different directives, but it’s still doing the same thing.
This is the top of my .htaccess:
RewriteEngine on
RewriteBase /
# Force the www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ <a href="https://www.%{http_host}/$1">https://www.%{http_host}/$1</a> [R=301,L]
# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
# force https
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond $1 !^(admin\.php|assets|css|system|i|images|themes|favicon\.ico|js|utils|sitemap\.php|index\.php) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
...See anything that could be causing this? I greatly appreciate any help. Thanks.