HomeWordpress

Redirect WordPress Site Between WWW and Non-WWW

Like Tweet Pin it Share Share Email

Last Post me maine aapko website ke liye Preferred domain set kaise kare iske bare me bataya tha, jisme aap Google me site Index karne ke liye www or non-www domain set kar sakte hain. Aisa karne se aapka SEO better hota hai aur sath me aap duplicate content ki problem se bhi bach sakte hain.

Preferred domain set karne se Google aapke set kiye gaye domain (www or non-www) me aapki site ko index karta hai.




Yah to baat preferred domain ki hui, lekin agar aapko apni site ko www or non-www me se kisi ek domain par redirect karna ho to uske liye kya karenge?

Normally, aapki wordpress site www and non-www dono domain par open hoti hai, magar aapko kisi ek domain www or non-www par karna hai to uske liye alag process hai.

Kayi baar maine yah bhi dekha hai kuch sites www or non-www me se kisi ek domain par open nahi hoti. Aisi condition me aapko apni site www or non-www me se kisi ek domain par redirect karna jaroori hai.

To chaliye main aapko batata hu kaise apni website ko www or non-www par Redirect kare.

Redirect Website non-www to WWW

Agar aapki wordpress site non-www (htttp://sample.com) se open hoti hai aur aap site ko www (http://www.sample.com) par redirect karna chhate hain then follow below steps:




  • Sabse pahle Hosting Account me login kare aur CPanel open kare.
  • Cpanel par File Manager icon par click kar open kare
  • File Manager me Public_html directory par click kar open kare
  • Public_html me aap .htaccess file dekh sakte hain.

htaccess file manager

.htaccess file par right click kare aur Edit par click kare.

.htaccess file Editing me sabse below side yah redirection code add kare aur .htaccess file save kare.

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

Remember: sample.com ki jagah apne domain name add kare.

Ab aap jab bhi non-www se apni site open karenge to wo automatically www par redirect ho jayegi.

Redirect website WWW to non-www

Agar aapki website www (http://www.sample.com) se open hoti hai aur aapko non-www (http://sample.com) par redirect karna hai to follow below steps:

.htaccess file me Edit par click kar sabse below yah code add kare.




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

Remember: sample.com ki jagah apna domain name add kare.

Ab jab bhi aap www se site open karenge to wo non-www par redirect hogi.

Final Words

Agar aapne Google search console me Preferred domain set kiya hai aur site properly www and non-www se open hoti hai to aapko redirection ki jarurat nahi kyunki aapne already preferred domain set kiya hai.

Agar aapne Google search console me preferred domain set nahi kiya hai to aap above method se apni site ko redirect kar sakte hain.

kayi baar website www or without www se open nahi hoti aisi condition me aap above method se site ko kisi ek domain par redirect kar sakte hain.

Read Also this about Page/post redirection:




Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *