Natasha
Natasha

Reputation: 980

301 permenanat redirect in opencart

I have to use 301 permenant redirect in my opencart site. Am using the following codes in my .htaccess. Both are working in the case of http:// but not in https://

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

and

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^meinedomain.de 
RewriteRule ^(.*)$ http://www.meinedomain.de/$1 [r=301,L] 

RewriteCond %{HTTPS_HOST} ^meinedomain.de 
RewriteRule ^(.*)$ https://ssl.meinedomain.de/$1 [r=301,L]

But some of my pages are loding in https:// like sign in, checkout etc. When i use the above code then am not able to sign in to the site. What changes are needed for the proper working of https...??

When I search my site in google then www. does not appear in the result. It shows mysite.com. What can I do for this?? Anybody please help. Thanks.

Upvotes: 3

Views: 2116

Answers (1)

Oussama Jilal
Oussama Jilal

Reputation: 7739

There is nothing called %{HTTPS_HOST}, try this (and don't forget to escape dots in regex) :

RewriteEngine on

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^meinedomain\.de$
RewriteRule ^(.*)$ http://www.meinedomain.de/$1 [r=301,L] 

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^meinedomain\.de$
RewriteRule ^(.*)$ https://ssl.meinedomain.de/$1 [r=301,L]

Upvotes: 1

Related Questions