cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution
Highlighted

URL without www redirects to homepage

Hi, I have installed Cloudflare SSL on my website about 10 days ago. Today I noticed that the links without www redirects the page to Homepage instead of the page it’s supposed to. For example, if you go to this URL:

 https://www.mswebarts.com/visitor-attraction-pro-home/

 

 it works. But if you go to

 https://mswebarts.com/visitor-attraction-pro-home/ 

it will redirect you to the homepage. I want this to be redirected to the link with www. This problem may be with DNS.

Please give me some solutions to this issue.

Looking forward to your reply.
Thank you in advance.

1 REPLY 1
Solution

Re: URL without www redirects to homepage

Got this fixed after adding the below code right after "RewriteEngine On" on my .htaccess file.

 

RewriteCond %{HTTP_HOST} ^your-domain.com [NC]
RewriteRule ^(.*)$ http://www.your-domain.com/$1 [L,R=301]

 

Now the URL https://mswebarts.com/visitor-attraction-pro-home/ redirects to https://www.mswebarts.com/visitor-attraction-pro-home/ but not to https://www.mswebarts.com

 

Let me know if it helps someone else also.