Redirect root domain to www subdomain and vice versa

Hayworth

Verified User
Joined
Sep 11, 2010
Messages
14
Redirect root domain to www Subdomain and vice versa

How can I redirect with DirectAdmin root domains (domain.com) to the subdomain (www.domain.com) permanently?

In Apache httpd.conf you have to add this lines to the virtual host:

RewriteEngine on
Rewritecond %{HTTP_HOST} !^www\.<domain>\.com
RewriteRule (.*) https://www.<domain>.com/$1 [R=301,L]

Is possible to do it with DirectAdmin panel? Can I writte the lines directily in httpd-vhosts.conf or some where?


Thank you.
 
Hello,

No, if you have no admin access, you can not do that, you should use .htaccess file.

Admin access? I am the administrator of the installation of DirectAdmin and I controll the server where it is. I prefer not to use .htaccess.

In Admin Level is it possible to use "Custom HTTPD Configurations" for that? I am quite newbie in DA...

Thank you.
 
Back
Top