Knowledgebase: Site Functions
Redirect to www.yourdomain.com
Posted by ASO Admin on 05 February 2020 01:55 PM

There is much discussion about whether it’s best for your site to display ‘yourdomain.com’ or ‘www.yourdomain.com’. While it technically doesn’t make a difference some people have their own preference for varying reasons, such as potential SEO benefits or the need for having a consistent domain address.

It’s super easy to push all requests for 'yourdomain.com' to re-direct to 'www.yourdomain.com'! To begin implementing this re-direct you’ll need to make an .htaccess file. 

If you already HAVE an .htaccess file in the public_html folder of your cPanel account, then simply add the text below to the top of the file and save it:

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

If you DO NOT already have an .htaccess file in the public_html folder then you’ll just need to create one:

  1. Open your favorite text editor (notepad, textedit)

  2. Save the file as .htaccess (yes, that ‘.’ at the beginning is supposed to be there)

Once the file has been created add the code shown below to the file and save it again:

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

 

Now, all that’s left to do is upload this file via either FTP or cPanel File Manager, and make sure that it’s in the public_html folder of your cPanel account. To verify your changes go ahead and visit your website (without the ‘www.’) and it should automatically change ‘yourdomain.com’ to ‘www.yourdomain.com’.

Note: if you recently visited your site before making the change then you may need to refresh the page or clear your web browser’s cache to see the changes.

If you need any assistance with this, please do not hesitate to get in touch with our support team! We’re here to help.

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion
ERROR: This domain name (kb.asmallorange.com), does not match the domain name in the license key file help.asmallorange.com.

For assistance with your license, please contact the Kayako support team: https://support.kayako.com