This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

website without www is 404
#1
website without www is 404
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.
Reply
Thanks given by:
#2
RE: website without www is 404
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:
  1. You have a A Record entry for yourdomain.com and for www.yourdomain.com.
  2. 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.
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by:
#3
RE: website without www is 404
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.
Reply
Thanks given by:
#4
RE: website without www is 404
Please check the Vhost for that domain.

Also please confirm if that domain is using the sentora DNS (check that at domain registar).
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by:
#5
RE: website without www is 404
(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.
Reply
Thanks given by:
#6
RE: website without www is 404
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
Reply
Thanks given by:
#7
RE: website without www is 404
Glad to see it is fixed Smile

Bt the way, VHosts is at /etc/sentora/configs/apache
Be careful if you edit it because it can break things.
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by:
#8
RE: website without www is 404
I just don't get it. @ equal mydomain.com, correct me if I am wrong.
Can someone explain it?
Reply
Thanks given by:
#9
RE: website without www is 404
Please do not double post your issues. (Other post removed, continue here)
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Split Website log files. spoonman 1 3 ,966 01-01-2022, 10:00 AM
Last Post: TGates
Uploaded Website Not Updating GiantEspresso 3 8 ,147 04-19-2020, 09:57 PM
Last Post: Ron-e
The website don't load naire 1 5 ,145 10-15-2019, 11:48 PM
Last Post: jamesmango

Forum Jump:


Users browsing this thread: 1 Guest(s)