0

Just migrate one site from one vps to another(ubuntu 14lts) I used virtualmin as control panel

I can access mysite via mysite.com, but can not access via www.mysite.com

Your comment welcome

Updated question:

mysite.com.conf

ServerAlias admin.mysite.com
DocumentRoot /home/mysite/public_html
ErrorLog /var/log/virtualmin/mysite.com_error_log
CustomLog /var/log/virtualmin/mysite.com_access_log combined
ScriptAlias /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 +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/mysite/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/mysite/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/mysite/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mysite.com
RewriteRule ^(.*) https://mysite.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mysite.com
RewriteRule ^(.*) https://mysite.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "mysite.com statistics"
AuthType Basic
AuthUserFile /home/mysite/.awstats-htpasswd
require valid-user
1
  • Do you have access to DNS records of this domain? Commented Sep 5, 2014 at 15:18

1 Answer 1

0

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 On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
6
  • nslookup www.mysite.com returns ** server can't find www.mysite.com: NXDOMAIN
    – arachide
    Commented Sep 5, 2014 at 15:29
  • nslookup mysite.com returns Non-authoritative answer: Name: mysite.com Address: 104.***.***.***(where it is)
    – arachide
    Commented Sep 5, 2014 at 15:30
  • Now what - does it exist or doesn't it? Your first comment says www.mysite.com doesn't exist, your second one says it's 104.xxx.xxx.xxx... My reply to your first comment: That means that the DNS name www.mysite.com does not exist. If you have control over your DNS, you need to create it (or let your hoster do it).
    – Jan
    Commented Sep 5, 2014 at 15:30
  • www.mysite.com returns error , mysite.com returns the correct result
    – arachide
    Commented Sep 5, 2014 at 15:33
  • So go and setup your DNS. If you have questions on how to do this, search or open another question. Also check if your webserver is properly configured.
    – Jan
    Commented Sep 5, 2014 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .