2017-04-26 71 views
0

我想強制使用opencart將OpenCart商店重定向到它的WWW版本。OpenCart htaccess重定向到WWW和SSL

SEO URL設置

RewriteEngine On 
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie./becomes /shop/ 

RewriteBase/
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L] 
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L] 
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L] 
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] 
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. 
# [NC] is a case-insensitive match 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

這是重定向htaccess的一部分,它的工作原理,但聰明的URL現在

https://www.example.com/index.php?route=the-name-of-the-product ,它應該是 https://www.example.com/the-name-of-the-product

任何想法如何用智能網址來解決這個問題? 我在做重定向錯誤或問題是其他?

回答

1

嘗試的.htaccess文件的開始移動以下行

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. 
# [NC] is a case-insensitive match 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]