How to redirect website to www in DirectAdmin?

If You wish to redirect Your website from http://example.com to http://www.example.com in DirectAdmin (or any other panel), follow below steps:

  1. In Your /domains/example.com/public_html directory create a file named .htaccess
  2. Paste below code:
     
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www. [NC]
    RewriteCond %{HTTP_HOST} ![0-9]$ [NC]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  3. Save and upload to Your server.
  4. If file .htaccess already exist, then check if it contain line:
    RewriteEngine on
  5. If no, then paste above code on top of the file.
  6. If yes, then replace line RewriteEngine on” with above code.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Resellers: How to create custom nameservers

If you have a reseller account you might like to have your own nameservers for your customer's...

How to Create Reseller or Master Reseller in DirectAdmin with DAreseller?

To change a Package as Reseller/Master Reseller Package follow these instructions Go to...

How to create an email account in DirectAdmin?

DirectAdmin is a hosting control panel for Linux server. Please perform the following steps to...

How to host a domain in DirectAdmin?

DirectAdmin is a hosting control panel for Linux server. Please perform the following steps to...

How to create an FTP account in DirectAdmin?

  Perform the following steps to create an FTP Account in DirectAdmin control panel: Login to...