I'm struggling with rewrite rules... again. Problem is that I need to redirect all requests from non-https and non-www to https://www. and need to keep the URL path and optionally parameters after the TLD.
I found many posts, however, I didn't manage to get it work with my other rules. What may be the problem here!?
Example URL:
http://ift.tt/1EYEgsc to http://ift.tt/1Gv3MHr
current htaccess (works fine so far except https/www redirect):
Options +FollowSymLinks
RewriteEngine On
RewriteBase /projects/currentProject/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule \.(css|js|png|jpg|gif)$ - [L,NC]
RewriteRule ^index/(.*)$ index.php [QSA]
RewriteRule ^activate/(.*)$ activate.php [QSA]
[...]
Tried these additional rules for https and www redirect (no luck):
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.tld.com%{REQUEST_URI} [NE,L,R=301]
Aucun commentaire:
Enregistrer un commentaire