1

Please help

How redirect HTTP root and index.php to HTTPS root. Styles and Scripts are on par with index.php.

RewriteEngine On

RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Thanks!

  • 1
    Possible duplicate of [htaccess redirect to https://www](http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www) – JazZ Dec 16 '16 at 19:04

1 Answers1

0

One way could be:

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be              included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}   [L,R=301]
# Now, rewrite any request to the wrong domain to use   www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%.   {REQUEST_URI} [L,R=301]
Blueblazer172
  • 588
  • 2
  • 15
  • 44