Opencart域重定向到www

Opencart域重定向到www,opencart,opencart2.x,Opencart,Opencart2.x,我正在尝试将我的opencart(版本2.1.0.1)基于非www的项目重定向到www。这项工作可以接受 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)不起作用。谁能指导我如何解决这个问题。谢谢

我正在尝试将我的opencart
(版本2.1.0.1)
基于非www的项目重定向到www。这项工作可以接受

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)不起作用。谁能指导我如何解决这个问题。谢谢

您可能已经删除了.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]
Options+FollowSymlinks
选项-索引
命令拒绝,允许
全盘否定
重新启动发动机
重写cond%{HTTP_HOST}^www\。
重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L]
重写基/
重写规则^sitemap.xml$index.php?route=feed/google_sitemap[L]
重写规则^googlebase.xml$index.php?route=feed/google_base[L]
重写规则^system/download/(.*)/index.php?route=error/not_found[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写条件%{REQUEST\u URI}!。*\。(ico | gif | jpg | jpeg | png | js | css)
RewriteRule^([^?]*)index.php?_route_uu=$1[L,QSA]