亚马逊 EC2 - 将 www.domain.com 重定向到 http://domain.com
Amazon EC2 - Redirect www.domain.com to http://domain.com
我是 Amazon EC2 Server 的新手,我在输入 www.domain.com 时遇到问题,我的网站无法加载。当我输入 http://domain.com it works fine. I googled and found that this is a canonical issue and I should redirect www.domain.com to http://domain.com 时。在堆栈溢出时,我找到了这个线程,然后我关注了它。
但是我的问题并没有消失。我在 httpd.conf 文件的回答中添加了虚拟主机部分。
现在看起来像这样:
<VirtualHost *:80>
DocumentRoot "/var/www/"
ServerName rafitapp.com
ServerAlias rafitapp.com www.rafitapp.com
<Directory "html/">
allow from all
Options +Indexes
</Directory>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.rafitapp.com [NC]
RewriteRule (.*) http://rafitapp.com%{REQUEST_URI} [R=301,L]
</VirtualHost>
我的 index.html 文件所在的文件夹是 /var/www/html/。
请指出我做错了什么。我已经用谷歌搜索了几个小时,但无法修复它。
任何建议都会对我有很大帮助。
谢谢
您可能需要在 DNS 中设置 CNAME 记录。
另外,测试时一定要清除浏览器缓存。
我是 Amazon EC2 Server 的新手,我在输入 www.domain.com 时遇到问题,我的网站无法加载。当我输入 http://domain.com it works fine. I googled and found that this is a canonical issue and I should redirect www.domain.com to http://domain.com 时。在堆栈溢出时,我找到了这个线程,然后我关注了它。
但是我的问题并没有消失。我在 httpd.conf 文件的回答中添加了虚拟主机部分。
现在看起来像这样:
<VirtualHost *:80>
DocumentRoot "/var/www/"
ServerName rafitapp.com
ServerAlias rafitapp.com www.rafitapp.com
<Directory "html/">
allow from all
Options +Indexes
</Directory>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.rafitapp.com [NC]
RewriteRule (.*) http://rafitapp.com%{REQUEST_URI} [R=301,L]
</VirtualHost>
我的 index.html 文件所在的文件夹是 /var/www/html/。
请指出我做错了什么。我已经用谷歌搜索了几个小时,但无法修复它。
任何建议都会对我有很大帮助。
谢谢
您可能需要在 DNS 中设置 CNAME 记录。 另外,测试时一定要清除浏览器缓存。