Opencart域重定向到www

时间:2016-02-16 07:11:23

标签: opencart opencart2.x

我尝试将基于opencart (version 2.1.0.1)的项目非www重定向到www。这接受answer工作正常。

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.example.ae/$1 [R=301,L]

但是当我在.htaccess(位于根文件夹中)中添加代码时,www.example.ae / admin和SEO URL(www.example.com/category-name)不起作用。任何人都可以指导我如何解决这个问题。感谢

1 个答案:

答案 0 :(得分:0)

您可能已删除.htaccess文件中的所有其他内容。请确保它看起来像这样:

Options +FollowSymlinks
Options -Indexes

<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
 Order deny,allow
 Deny from all
</FilesMatch>

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=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]
相关问题