Forum Moderators: phranque
https://www anyway, so I don't think it has got anything to do with that. RewriteEngine on
# send people from non-www to www
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
# send people from http to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{SERVER_PORT} =80 [OR]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) https://www.example.com/$1 [R=301,L] And if you expect different cased requests, you can add a line for that with the [OR] flag. RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
if you can’t spot a redirect chain with your browser, then your website probably responds to crawlers’ and browsers’ requests differently, and you still need to fix the issue
# send people from http to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
RewriteEngine on
RewriteRule ^index\.php$ https://www.example.com/ [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] seems to add on a trailing slash to directories without one (although if I'm perfectly honest I can't work out how!)
The DirectorySlash directive determines whether mod_dir should fixup URLs pointing to a directory or not.
Typically if a user requests a resource without a trailing slash, which points to a directory, mod_dir redirects him to the same resource, but with trailing slash for some good reasons...
the new .htaccess code i've started using above has stopped redirecting example/index.php to example/
and seems to add on a trailing slash to directories without one (although if I'm perfectly honest I can't work out how!)
[edited by: not2easy at 1:33 am (utc) on Aug 22, 2017]
[edit reason] requested edit [/edit]