2017-04-26 13 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

任意のアイデアどのようにする必要がありますこの問題をスマートなURLで解決するには? リダイレクトを間違っているのですか、それとも他の問題ですか?

答えて

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] 
関連する問題