cancel
Showing results for 
Search instead for 
Did you mean: 

Store View URL "WWW" Redirect Issue

Store View URL "WWW" Redirect Issue

Hi guys,

 

I have 2 stores which are abc.com.au (main) and abc.co.nz (second store view)

Here are the Nginx conf and index.php

https://imgur.com/a/aGMGC9x

In the Magento backend, I set the Base Url: http:///www.abc.co.nz and Secure Base URL: https://www.abc.co.nz

 

The issue is that if I try to access with abc.co.nz, expected result will be redirect to www.abc.co.nz but instead it only sit at abc.co.nz and some styles will break due to CORB

And if I type www.abc.co.nz it will redirect to abc.com.au?

Can anyone help me please.

2 REPLIES 2

Re: Store View URL "WWW" Redirect Issue

Hi @tony_le2 

Check the below stack solution.

https://stackoverflow.com/a/11733363

I hope it will help you!

Re: Store View URL "WWW" Redirect Issue

Hello @tony_le2 

 

inside server please add below thing

 

server {
    listen 80;

    if ($host !~ ^www\.) {
        rewrite ^ https://www.$host$request_uri permanent;
    }
   // then your code
}

if works then mark as solution 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer