域用户桌面重定向_一个简单的URL重定向到您的根域

域用户桌面重定向

If you’re finding the above result when you try to access your website on Google Chrome, this article might hold your solution. First I’ll outline how I discovered my issue, and how I traced my steps to find the root source. Then I’ll explain the simple solution that will work for you if your issue stems from the same cause as mine.

如果您尝试通过Google Chrome浏览器访问网站时发现上述结果,则本文可能适用您的解决方案。 首先,我将概述如何发现问题以及如何跟踪步骤以查找根源。 然后,我将解释一种简单的解决方案,如果您的问题与我的原因相同,那么该解决方案将为您服务。

在一个浏览器上工作,但在另一个浏览器上不工作 (Works on One Browser but Not the Other)

I recently finished retooling my website with a responsive design, so I pushed the changes to Heroku where my site’s deployed. When I visited the site on my iPhone’s Safari browser, it looked just like I expected. But I typed in the same URL in my iPhone’s Google Chrome browser and saw the error from above that says “This site can’t be reached…server IP address could not be found.” This lead to frantically checking my website on both browsers on all the devices in the apartment including my girlfriend’s iPhone. I type the same “choowatchin.com” into each address bar; sure enough Safari always found my site, and Google Chrome never found my site.

最近,我以响应式设计完成了网站的重新设计,因此我将更改推送到了部署网站的Heroku。 当我在iPhone的Safari浏览器上访问该网站时,看起来就像我期望的那样。 但是我在iPhone的Google Chrome浏览器中输入了相同的URL,然后从上方看到错误消息:“无法访问此站点……找不到服务器IP地址。” 这导致我在公寓中所有设备(包括女友的iPhone)的两个浏览器上疯狂地检查了我的网站。 我在每个地址栏中输入相同的“ choowatchin.com”; 确保有足够的Safari能够始终找到我的网站,而Google Chrome浏览器从未找到我的网站。

I wasn’t sure why this happened. The only place I could pull up my website on Google Chrome was on my own MacBook Pro, which I used to build the site. Then I realized that Google Chrome autofilled my website as soon as I typed “choo”, so I deleted my history and tried it again. My suspicion was confirmed when Google Chrome no longer found my site after I deleted my browsing history. On a hunch, I tried typing “www.choowatchin.com” instead of leaving off the “www” like I had been. There it was! I tried it on all the other devices again, and they all worked.

我不确定为什么会这样。 我唯一可以在Google Chrome浏览器上打开网站的地方就是我自己的MacBook Pro,我曾用它来构建该网站。 然后我意识到,只要输入“ choo”,Google Chrome就会自动填充我的网站,因此我删除了历史记录,然后再次尝试。 当我删除浏览历史记录后Google Chrome不再找到我的网站时,证实了我的怀疑。 直觉上,我尝试键入“ www .choowatchin.com”,而不是像以前那样忽略“ www”。 在那里! 我再次在所有其他设备上尝试过,它们都正常工作。

That in itself was a relief, but I still wanted to fix my site so it didn’t hide from Google Chrome when the user forgot the “www”. After scouring the Internet for solutions to this problem, I found that the simplest solution is to set up a URL Redirect.

这本身是一种缓解,但是我仍然想修复我的网站,以便当用户忘记“ www”时它不会在Google Chrome中隐藏。 在Internet上搜索该问题的解决方案后,我发现最简单的解决方案是设置URL重定向。

通过DNS设置设置重定向 (Setting Up the Redirect Through DNS Settings)

Heroku hosts my website, and I go into detail about setting up custom domains for Heroku apps in a previous blog.

Heroku托管我的网站,在上一个博客中,我详细介绍了如何为Heroku应用程序设置自定义域。

I bought my domain from Namecheap, so it is there I configure the DNS (Domain Name System) Settings to connect my domain to my app. Rereading my old blog post, I noticed something from the DNS Settings that I previously thought unnecessary. It was a URL Redirect Record created by default upon purchasing my domain. I had deleted it, and my app seemed to work fine so I forgot about it until now. Deleting that URL Redirect Record finally caught up with me when Google Chrome refused to recognize my URL without “www” prepended. So what was it I deleted?

我是从Namecheap购买域名的,所以在那里配置了DNS(域名系统)设置以将域名连接到我的应用程序。 重新阅读我的旧博客文章后,我注意到DNS设置中以前认为不必要的某些内容。 这是在购买我的域时默认创建的URL重定向记录。 我已经删除了它,而我的应用似乎运行正常,所以直到现在我都忘记了它。 当Google Chrome浏览器拒绝在没有“ www”作为前缀的情况下识别我的URL时,删除该URL重定向记录终于引起了我的注意。 那我删除了什么?

Image for post

It was a URL Redirect Record with a Host of “@” and a Value of “http://www.choowatchin.com/”. The @ Host signifies the root domain, which is just my website URL without the “www” business at the start. The Value is just the full website domain.

这是一个URL重定向记录,其主机为“ @”,值为“ http://www.choowatchin.com/”。 @主机表示根域,它只是我的网站URL,开头没有“ www”业务。 价值只是完整的网站域。

Once I added the URL Redirect Record back to the DNS settings in my Namecheap account, I could be my lazy self again, leaving off the “www” and making it to my website on Google Chrome all the same.

将URL重定向记录添加回Namecheap帐户中的DNS设置后,我可能又会变得懒惰,不再使用“ www”,而是完全将其转到Google Chrome上的网站。

翻译自: https://medium.com/dev-genius/a-simple-url-redirect-to-your-root-domain-883090c11caf

域用户桌面重定向

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值