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.

  • 46 Users Found This Useful
Was this answer helpful?

Related Articles

Does your PHP installation include IonCube loaders?

Yes, these loaders are available with our PHP installations on all our servers.

Disk space & Traffic

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

I cant connect to Canada Post sellonline.canadapost.ca

If you are setting up a Shipping account for Canada Post in your Shopping Cart and you are...

How can i upgrade or downgrade my Hosting?

Upgrading is a simple procedure from the Client Portal that you can do yourself at anytime. When...

How do upload files to web space?

There are 2 methods available for doing this. The easiest and best method is to use a FTP client...

Powered by WHMCompleteSolution