从 url 中删除 www 时出现 htaccess 服务器错误
.htacess error
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.netsentries.com
RewriteRule ^(.*)$ http://netsentries/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
仅当我添加此行时才会出现错误。
RewriteCond %{HTTP_HOST} ^www.netsentries.com
RewriteRule ^(.*)$ http://netsentries/$1 [R=301,L]
我必须添加它,因为我的网站现在无法加载 www。我想让它加载。
.htacess error
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.netsentries.com
RewriteRule ^(.*)$ http://netsentries/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Error only comes when I add this line.
RewriteCond %{HTTP_HOST} ^www.netsentries.com
RewriteRule ^(.*)$ http://netsentries/$1 [R=301,L]
I have to add it because my site is not loading with www now. I want to make it load.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用此代码,您的 htaccess 问题将得到解决:
如果您在使用 www 加载您的网站时遇到问题,那是因为您的网站主机丢失了 www CNAME 记录。您应该从网站托管包的“DNS 区域编辑器”中检查名称服务器,并添加 www 所需的记录,如下所示:
这将使您的网站在有 www 和没有 www 的情况下都能工作。
Use this code and your htaccess problem will be solved:
and if you have problem loading your site with www it is because of loosing www CNAME record from your website's host. You should check the nameservers from "DNS zone editor" of your websites hosting package and adding required records for www like this:
this will cause your website to work in both with and without www.
尝试一次
Try this once