http://example.com有效,但www.example.com无效



All,标题说明了一切。我有一个在GoDaddy注册的域名,并在Azure中设置了一个网络应用程序。在Godaddy中,我已经正确地设置了我的CName和A文件,尽我所能。

当我打字的时候,我一定对他们做了一些正确的事情http://example.com在浏览器的地址栏中,index.html会返回。然而,当我在www.example.com中键入时,我会得到Azure的404错误/页面,上面写着找不到页面。

我很困惑。有人能帮忙吗?谢谢

只是为了确保

A Record
* > your ip
@ > your ip
CName
www > @

检查服务器配置(例如,我在ubuntu中使用apache2)

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "/home/www.example.com/"
ServerName example.com
ServerAlias *.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1$1 [R=permanent,L]
<Directory "/home/www.example.com/">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
        Require all granted
    </IfVersion>
</Directory></VirtualHost>

重要的部分是ServerAlias和重写规则

相关内容

最新更新