How do i redirect my website from nonwww to www?

shotvpro

New member
Joined
Dec 9, 2024
Messages
1
Points
0
Hi, I have my website. I recently indexed my website on google, but the same page is getting indexed in 2 URL's.
One with www and other without www. How do I redirect my non-www page to www? please help me.
The site is working on next.js platform.
 

topafricans

New member
Joined
Dec 17, 2024
Messages
1
Points
0
use this code on your server

server { listen 80; server_name yourdomain.com; return 301 http://www.yourdomain.com$request_uri; }
server { listen 80; server_name www.yourdomain.com; root /path/to/your/site; # Other server configurations }
 

ashleydent4u

New member
Joined
Nov 21, 2024
Messages
9
Points
3
Hey! To fix the issue of your site being indexed with both www and non-www URLs, you need to set up a redirect. Since you're using Next.js, you can do this by adding a rewrite rule in your next.config.js file.
 
Latest threads
Replies
1
Views
43
Replies
0
Views
102
Replies
2
Views
103
Replies
1
Views
78

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top