0

I'm trying to redirect my opencart (version 2.1.0.1) based project non-www to www. This accepted answer working fine.

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

But when i added the code in .htaccess (which is located in the root folder. ) www.example.ae/admin and SEO URL (www.example.com/category-name) does not working. Can any one guide me how can i fix this issue. Thanks

Community
  • 1
  • 1
Ayaz Ali Shah
  • 3,453
  • 9
  • 36
  • 68

1 Answers1

0

You have probably deleted everything else in your .htaccess file. Please make sure it looks something like this:

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]
Tibor B.
  • 1,680
  • 1
  • 10
  • 12