【问题标题】:Getting 404 on valid subdomain pages when refreshing刷新时在有效子域页面上获取 404
【发布时间】:2020-05-09 04:01:39
【问题描述】:

我在子域staging.mysite.com 上有一个站点,当我刷新该 URL 时,所有页面都会收到 404。这就是说我可以从应用程序根目录导航到任何页面并且加载正常,但是如果我刷新该页面,我会得到 404。

我认为这可能是 DNS 问题?

mysite.com 托管在 Godaddy 上,是我帐户的主域。我有一条 staging 的 A 记录指向我的托管 IP,我已将 staging 添加为子域,域为 staging.mysite.com,文档根为 public_html/staging

当我在我的本地主机上开发时没有问题,只有当我部署到临时站点时。这让我相信这不是 VueJS 路由问题。

这是 DNS 配置错误吗?

【问题讨论】:

    标签: vue.js dns http-status-code-404


    【解决方案1】:

    您是否更新了 .htaccess?

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.html$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.html [L]
    </IfModule>
    

    附加信息 Example Server Configurations

    【讨论】:

    • 非常感谢。那成功了。我在那个根目录中没有 htaccess 文件。
    猜你喜欢
    • 1970-01-01
    • 2020-03-06
    • 2013-07-28
    • 2016-05-21
    • 2021-08-15
    • 2019-11-27
    • 1970-01-01
    • 2018-12-26
    • 2019-07-15
    相关资源
    最近更新 更多