cancel
Showing results for 
Search instead for 
Did you mean: 

HTTPS redirects to homepage

SOLVED

HTTPS redirects to homepage

Hello, I want to have all the web in HTTPS, so I put like in the screenshot. The problem is that when I click in a product or other link (organic) in Google redirects to the homepage.

Captura de pantalla 2018-01-10 a las 11.05.59.png

I have this in .htaccess:

 

## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

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

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
1 ACCEPTED SOLUTION

Accepted Solutions

Re: HTTPS redirects to homepage

Yes, You have to keep unsecure url with https in system -> configuration -> web -> base url section.

 

Please let me know if you have any query.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

7 REPLIES 7

Re: HTTPS redirects to homepage

Hi @Espamoto,

 

Normally this should be enough:

 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Or if you can set the configuration at vhost configuration, something like:

 

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.your-domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Re: HTTPS redirects to homepage

Thanks, I have tested the first and it´s ok I think.

But when I am in the web I see that the links (categories for example) are in http and then when I click it´s redirected to https.

So, in the UNSECURE part, I have to put the url with HTTPS?
Thanks!

Re: HTTPS redirects to homepage

Yes, You have to keep unsecure url with https in system -> configuration -> web -> base url section.

 

Please let me know if you have any query.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: HTTPS redirects to homepage

Hello, I have the problem that the products with http redirects to homepage.

I have this in htaccess:

 

## enable rewrites

    Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Re: HTTPS redirects to homepage

I have now like this and appears to be correct:

 

## enable rewrites

    Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

Re: HTTPS redirects to homepage

Your .htaccess Code does not work for me, I get ERR_TOO_MANY_REDIRECTS

Re: HTTPS redirects to homepage

If  your getting too many redirects you can try using this one:

 

#enable rewrites

Options +FollowSymLinks
RewriteEngine on

# Rewrite any request to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Rewrite to HTTPS:
RewriteCond %{HTTPS} off

# Don't put www. here the ABOVE rule will catch it.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Manchester Web Design | Creative Ecommerce Solutions
www.valendigital.co.uk
Found one of my answers useful? please give "Kudos" or "Accept as Solution"