-2

need do auto redirect to https://www.... with SEO, i have that code

Options +FollowSymlinks
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] // that for SEO variable

How i can do, if customer use http:// auto redirect to https://www.* AND if use https://name.com (without www.) auto redirect to https://www.* ? and too with variable $1 for SEO :) need to supplement the existing rule, sorry for my English)

1 Answers1

0

Add this under Rewritebase /:

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • don't work, if i remove `https://` (manually) he redirect to `https://www.www......` if i remove `wwww.` then all is well (adds it back), and SEO don't work, SEO work if that code `RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]` – Dimitry lmz Aug 19 '14 at 16:12
  • @Dimitrylmz I have no clue what you're saying – Jon Lin Aug 19 '14 at 16:20