If I don't type www and my website is 404.
I have to type
www.mydomain.com to access my website.
I wonder what is the reason cause this issue.
Thanks.
It can have multiple causes, are you using any particular software on your website (like wordpress, joomla, etc)? Sometimes they change the .htaccess and might cause issues.
Quick Fix for .htaccess:
Try adding this to the
.httaccess file
(however this is probably NOT what you should fix, read below):
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Probably your issue is related to the
DNS or
VHOSTS setup, please check the following:
DNS Setup:
- You have a A Record entry for yourdomain.com and for www.yourdomain.com.
- Both entries are using the same IP Address (either IPv4 and/or IPv6 if applicable).
NOTE: Your DNS setup might be using Sentora Bind9, CloudFlare, Your Registar or your Hosting Provider, it only needs to be changed on ONE of those places, it's up to you do know witch one you are using.
V-HOSTS Setup:
You should have something like this on your V-HOSTS file for
yourdomain.com
Code:
<VirtualHost *>
ServerName www.yourdomain.com
ServerAlias yourdomain.com
</VirtualHost>
What
you need to check is the
ServerAlias directive, the rest is here only for reference.
Please note that your VirtualHost may differ a LOT from the above example (usually it has much more lines).
Hope this helps you.
Thanks for your reply.
I am hosting multiple domains on my server.
Each domain has a user account.
All of the domains setting are the same.
I tried the dns same setting on one of the domain, it works properly.
For the domain that does not work properly, I have the following setting for the dns.
At my domain resister nameservers are ns1.mydomain.com and ns2.mydomain.com.
Both ns1.mydomain.com and ns2.mydomain.com are pointed to the same ip.
At Sentora DNS Manager, I created dns records.
It pretty much is default.
For A record
I have
Host Name: @, mail, ns1, ns2
TTL: 3600, 86400, 17280, 17280.
Target: my VPS IP.
For CName
Host Name: www, ftp, subdomains.
TTL: 3600, 3600, 86400
Target: @, @, @
For the exactly same setting, it works on my other domains.
For the Vhost, I never touch it.
I have issue with one of the user account, not the zadmin account or zadmin domain.
Please check the Vhost for that domain.
Also please confirm if that domain is using the sentora DNS (check that at domain registar).
(03-31-2015, 06:59 AM)apinto Wrote: [ -> ]Please check the Vhost for that domain.
Also please confirm if that domain is using the sentora DNS (check that at domain registar).
I have CentOS 6 32bit. How to check vhost?
Yes, I am using Sentora DNS Manger.
Sentora DNS Manger created nameservers (ns1.mydomain.com and ns2.mydomain.com).
At domain register, I have my domain nameservers set as ns1.mydomain.com and ns2.mydomain.com
And both nameservers (ns1.mydomain.com and ns2.mydomain.com) are pointed to my VPS ip.
Thank you.
After I changed @ to mydomain.com in CName record at Sentora DNS Manger.
The website show up properly.
Before
Host Name:www
Target: @
After
Host Name:www
Target: mydomain.com
Glad to see it is fixed
Bt the way, VHosts is at /etc/sentora/configs/apache
Be careful if you edit it because it can break things.
I just don't get it. @ equal mydomain.com, correct me if I am wrong.
Can someone explain it?
Please do not double post your issues. (Other post removed, continue here)