bspacer1 bspacer2
webmail hosting forum clients about

Computer Co-op, CornerNET Internet Gateway, and PJR Solutions is owned by PJR Sales & Service. Quality products and online services since 1991. We can be your
Complete Computer Connection

Hosting @ $5.95

Domains @ $16.98
Home PagePortal HomeClient AreaAnnouncementsKnowledgebaseSupport TicketsDownloadsRegister

Knowledgebase
You are here: Portal Home > Knowledgebase > cPanel Related Issues > cPanel HOW-TOs > How to redirect non-www URLs to www?

How to redirect non-www URLs to www?

In order to redirect all of the requests for yourdomain.com to www.yourdomain.com, you should set the appropriate rewrite rule. This can be done by adding the following lines at the beginning of the .htaccess file in your public_html folder:

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


From now on, when someone accesses http://yourdomain.com s/he will be redirected to http://www.yourdomain.com.

Using this method is safe because it should not create any redirection loops nor it should interfere with other rewrite rules.



Was this answer helpful?

Add to Favourites
Print this Article

Also Read
How can I create different types of web redirect with my cPanel? (Views: 9230)
How can I enable anonymous FTP access in cPanel? (Views: 10271)
How can I retrieve the raw Apache access logs for my site? (Views: 2079)
How can I check my quota and bandwidth limits/usage? (Views: 11911)
How can I password protect a directory with cPanel? (Views: 11147)

Powered by WHMCompleteSolution


Copyright © 1994-2021 PJR Sales and Service All Rights Reserved