How to Redirect Non-WWW to WWW

The easiest way to redirect domain.com to www.domain.com on the url address bar whenever someone omits or skips the www from domain.com is to configure the Apache web sever.


An Apache 301 redirect is the most efficient and search engine friendly method for webpage redirections. You can place following code in a .htaccess file directly from your DirectAdmin Control Panel.


1. Once logged into your Control Panel using the File Manager goto your domains "public_html" folder.


2. At the bottom locate "Create New File" and enter ".htaccess" and click create, inside the editor box paste the code below.

 

RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain\.com

RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]


3. Replace "domain.com" with your own domain name.

Was this answer helpful?

 Print this Article

Also Read

Where is my Hosting Account Info?

When you sign-up for a Hosting account all your Hosting Account information is sent in an email....

Running Scripts

If you are having troubles with Perl CGI or PHP scripts please read the following...

How-To prevent people from stealing your files & bandwidth (hotlink)

If you find that people are stealing your files or using your bandwidth tehn you can prevent this...

How to Redirect Non-WWW to WWW URLs in Joomla

he Problem When Search engines crawl your website they will consider http://bluebirdnet.ca and...

Disk space & Traffic

Disk Space Everything related to your Web site is stored on disk: your regular html files,...

Powered by WHMCompleteSolution