JQuery - 找不到 HTTP 404 - 服务器未找到与请求的 URI 匹配的任何内容



我正在努力自学前端开发,并在让jquery工作时遇到了问题。 我的所有网站都张贴在这里:http://mike.shea.sdf.org

应该

发生的是在标题和导航按钮之间,应该有博客文章。这些条目被手工编码到 postBuilder.js 文件中,该文件(连同助手.js和 jquery lib)应该生成 HTML 来显示帖子。

它具有以下结构:

html  
  index.html  
  blog.css  
js  
  jquery-2.2.1.min.js  
  helper.js  
  postBuilder.js  

我对所有内容都有读取/执行权限。

在我自己的机器上本地测试时一切都很好,但是当发布到服务器时,我在控制台上得到了这个:

HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
GET - http://mike.shea.sdf.org/js/jQuery-2.2.1.min.js

如果我将所有内容放在根 html 文件夹下,它可以工作。我有理由确定我正确输入了相对路径。同样,在本地,文件具有相同的结构并且它们有效。如果你看一下源代码,你会发现我尝试了多个jQuery lib文件,并尝试将其放在根html文件夹中。 我真的不知道接下来要看什么。这是 html 文件:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Contemplating Tech</title>
    <!-- Bootstrap core CSS -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom styles-->
    <link href="blog.css" rel="stylesheet">
    <script src="/js/jQuery-2.2.1.min.js"></script>
    <!-- <script src="./jQuery-2.2.1.min.js"></script> -->
    <!-- <script src="https://code.jquery.com/jquery-2.2.1.js></script> -->
    <script src="/js/helper.js"></script>
  </head>
  <body>
    <div class="blog-masthead">
      <div class="container">
        <nav class="blog-nav">
          <a class="blog-nav-item active" href="#">Home</a>
          <a class="blog-nav-item" href="#">New features</a>
          <a class="blog-nav-item" href="#">About</a>
        </nav>
      </div>
    </div>
    <div class="container">
      <div class="blog-header">
        <h1 class="blog-title">Contemplating Tech</h1>
        <p class="lead blog-description">Personal musings about technology, web development and whatever else I come across.</p>
      </div>
      <div class="row">
        <div id="posts" class="col-sm-8 blog-main">
          <script src="/js/postBuilder.js"></script>
          <nav>
            <ul class="pager">
              <li><a href="#">Previous</a></li>
              <li><a href="#">Next</a></li>
            </ul>
          </nav>
        </div><!-- /.blog-main -->
        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
          <div class="sidebar-module sidebar-module-inset">
            <h4>About</h4>
            <p>Mike has been involved with desktop support in one manner or another for 20+ years. This will be both a personal blog and a sandbox as he works on improving his front end web development skill set.</p>
          </div>
          <div class="sidebar-module">
            <h4>Archives</h4>
            <p>When I get a little better at getting posts in here and finding how to create an archive, I'll populate a list here.</p>
            <!--<ol class="list-unstyled">
              <li><a href="#">March 2014</a></li>
              <li><a href="#">February 2014</a></li>
              <li><a href="#">January 2014</a></li>
              <li><a href="#">December 2013</a></li>
              <li><a href="#">November 2013</a></li>
              <li><a href="#">October 2013</a></li>
              <li><a href="#">September 2013</a></li>
              <li><a href="#">August 2013</a></li>
              <li><a href="#">July 2013</a></li>
              <li><a href="#">June 2013</a></li>
              <li><a href="#">May 2013</a></li>
              <li><a href="#">April 2013</a></li>
            </ol>-->
          </div>
          <div class="sidebar-module">
          </div>
          <div class="sidebar-module">
            <h4>Elsewhere</h4>
            <ol class="list-unstyled">
              <li><a href="http://github.com/LottaJavaMike">GitHub</a></li>
              <li><a href="https://twitter.com/ContemplateTech">Twitter</a></li>
            </ol>
          </div>
        </div><!-- /.blog-sidebar -->
      </div><!-- /.row -->
    </div><!-- /.container -->
    <footer class="blog-footer">
      <p>Blog template built for <a href="http://getbootstrap.com">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>.</p>
      <p>
        <a href="#">Back to top</a>
      </p>
    </footer>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> -->
    <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> -->
  </body>
</html>

任何和所有的帮助或建议,不胜感激!

当我查看您的页面并导航到源代码 (http://mike.shea.sdf.org/js/jQuery-2.2.1.min.js) 中指定的位置时,我也会收到 404 错误。

现在,我可以导航到您的helper.js文件,该文件似乎具有相同的路径,因此您需要三重检查jQuery文件的命名。

另外,(顺便说一句)正如我在评论中提到的,您在指向jQuery文件的链接(/)中有一个前导正斜杠。这意味着 js 文件夹是服务器根目录的子文件夹,它可能与您谈论的 HTML 文件夹的子文件夹不同。从链接中删除正斜杠,并确保js文件夹是 HTML 文件所在文件夹的子文件夹。