Just migrate one site from one vps to another(ubuntu 14lts)I used virtualmin as control panelI can access mysite via mysite.com, but can not access via www.mysite.comYour comment welcomeUpdated question:mysite.com.confServerAlias admin.mysite.comDocumentRoot /home/mysite/public_htmlErrorLog /var/log/virtualmin/mysite.com_error_logCustomLog /var/log/virtualmin/mysite.com_access_log combinedScriptAlias /cgi-bin/ /home/mysite/cgi-bin/ScriptAlias /awstats/ /home/mysite/cgi-bin/DirectoryIndex index.html index.htm index.php index.php4 index.php5<Directory /home/mysite/public_html>Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGIallow from allAllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatchRequire all grantedAddHandler fcgid-script .phpAddHandler fcgid-script .php5FCGIWrapper /home/mysite/fcgi-bin/php5.fcgi .phpFCGIWrapper /home/mysite/fcgi-bin/php5.fcgi .php5</Directory><Directory /home/mysite/cgi-bin>allow from allAllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatchRequire all granted</Directory>RewriteEngine onRewriteCond %{HTTP_HOST} =webmail.mysite.comRewriteRule ^(.*) https://mysite.com:20000/ [R]RewriteCond %{HTTP_HOST} =admin.mysite.comRewriteRule ^(.*) https://mysite.com:10000/ [R]RemoveHandler .phpRemoveHandler .php5php_admin_value engine OffIPCCommTimeout 31FcgidMaxRequestLen 1073741824<Files awstats.pl>AuthName mysite.com statisticsAuthType BasicAuthUserFile /home/mysite/.awstats-htpasswdrequire valid-user
can access mysite via mysite.com, but can not access via www.mysite.com
webserver;apache httpd
Test the first one with nslookup www.mysite.com, if that doesn't give you the correct IP then you need to correcty setup DNS first.You need to have a DNS CNAME for www.mysite.com, if that's done you must configure an alias on the webserver.Once you have that in place, you can - if wanted - rewrite URIs that don't have the www. prepended using mod_rewrite (Google doesn't like such duplicate content):RewriteEngine OnRewriteCond %{HTTP_HOST} ^example\.com$ [NC]RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]