apache - WAMP 服务器不允许使用“www”访问网站
问题描述
我无法在域名前使用“www”访问我的网站,但如果我不使用“www”,我可以。我希望两者都可以访问。
我非常熟悉在 Linux 上使用 Apache2 Server,但我不必经常将它与 WAMP 一起使用。我在配置文件中做了很多乱七八糟的事情,并尝试了几种不同的方法,但似乎没有任何效果。
这是 httpd-vhosts.conf 文件:
# Virtual Hosts
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName wherehousemke.com
DocumentRoot "c:/wamp64/www/wherehousemke"
<Directory "c:/wamp64/www/wherehousemke/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
Require all granted
</Directory>
</VirtualHost>
我试图让它工作的网站是http://wherehousemke.com。该 URL 有效,但如果您在其中添加“www”,它将无法正常工作。
解决方案
您需要添加从 TLD 重定向到 www 子域https://www.digitalocean.com/community/questions/using-cname-for-www-redirection的 DNS 记录
推荐阅读
- javascript - 如何在不调用父函数的情况下调用子函数
- c# - 使用回车 CR(“\r”)和换行 LF(“\n”)作为分隔符的字符串(数组)连接和拆分操作上的 UWP C# 令人费解的行为
- opengl - OpenGL SSAO 奇怪的神器
- javascript - 在反应中获取数据的最佳方法是什么?
- c - 用巴比伦方法计算 $\sqrt[3]{x}$
- javascript - 将一个数组拆分为相等和的相等连续子数组
- html - 使用 REGEX 以 html 形式验证欧洲逗号分隔的价格
- vba - TransferSpreadsheet - 运行时错误 4298 - 指定范围
- python - 使用onclick按钮登录网站提交
- r - R使用变量访问列表元素