I want to force trailing slashes on a Magento site. Under normal circumstances the code below works fine. However, this site has some https pages such as the login and checkout pages. I'm wondering how I account for this in the htaccess file? I'm assuming I need to set up a separate rule for these https pages?
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.domain.com/$1/ [L,R=301]
Thanks.
You can use this to force a trailing slash for both HTTPs
and http
:
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
Make sure you clear your cache before testing this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.