简体   繁体   中英

Server without www returns 404

I'm running Apache2 on Debian Jessie, when i try to enter my site without www. it returns a 404 page.

What i have in apache config:

<VirtualHost *:80>
   DocumentRoot "/var/www/sites/example.com"
   ServerName www.example.com
   ServerAlias example.com
</VirtualHost>

<VirtualHost *:443>
    SSLEngine On
    DocumentRoot "/var/www/sites/example.com"
    ServerName www.example.com
    ServerAlias example.com
    SSLCertificateFile /etc/chain.pem
    SSLCertificateKeyFile /etc/key.pem
</VirtualHost>`

Now , there are no other definitions in "sites-enabled" that mentions the site

1- Both example.com and www.example.com have the same ip ( Not a DNS problem )

2- There are no extra configurations in "sites-available"

3- https://example.com works fine but http://example.com returns a 404

有一个<VirtualHost *:80>没有ServerName ,而apache使用默认服务器主机名是example.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM