Most of webhosting companies which have cPanel offer a feature call redirects and using this, you can redirect any domain to new domain or non www version to www version of site and vice versa. In this tutorial, I’m explaining how you can use 301 domain redirection feature in Hostgator Hosting. If you are not aware about Hostgator, I suggest you to check out Hostgator review page.
301 Redirect Using cPanel
If you want to give 301 redirect to a domain to any other address but unable to do this using .htaccess file then you can do this direct from your hosting control panel. With hosting control panel you can redirect a naked domain to www or you can also redirect it to any other domain or a webpage under a domain to any other page under the same or different domain. Here is a simple and easy to understand tutorial how to redirect a domain using HostGator cPanel.
Redirecting a naked domain to www
Warning: Use this method only if your preferred domain is with www such as in blogger blog. If your preferred domain is a naked domain, it causes infinite loops i.e your domain is continuously redirecting between www and non www.
- First login to your HostGator hosting account
- Now go to the tab “domains” >Redirect
Now fill the data as given below
- Select option 301 redirect
- Select your domain to redirect
- Enter the domain name with www
- Select redirect method “Do Not Redirect www.”
- Then press “add redirect”
Redirecting a domain to any other domain
- Select redirection type 301 or 302 as you want
- Select the domain to redirect
- Enter the domain name or webpage address as a destination
- Select redirect type “Redirect with or without www.”
Redirection Using .htaccess file
But finally we say that using .htaccess file to give redirections is the best method but it require advance editing.
Redirecting a naked domain with www
- Edit your .htaccess file using notepad and add the following line to redirect naked domain to www
- redirect 301 / http://www.yourdomain.com/
Redirect any webpage to any address
- redirect 301 /example.htmlhttp://www.other.com/new.htm
It’s always a good idea to redirect non www to www or vice versa depending upon your settings. As if your website is accessed via domain.com and www.domain.com, it’s bad for SEO.