javascript - 使用 XAMPP 的 AngularJS 找不到页面

标签 javascript angularjs apache tomcat xampp

我有以下文件夹结构:

C:\xampp\htdocs\project

在项目文件夹中,我有一个 index.html 文件和其他文件夹,其中包含 js 文件和缩小版本的 angularangular-route.

我安装了 XAMPP 并启动了所有模块(MySQL、FileZilla、Mercury、Tomcat),只有 Apache 没有启动,抛出这些消息:

5:14:15 PM  [Apache]    Status change detected: stopped
5:14:15 PM  [Apache]    Error: Apache shutdown unexpectedly.
5:14:15 PM  [Apache]    This may be due to a blocked port, missing dependencies, 
5:14:15 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
5:14:15 PM  [Apache]    Press the Logs button to view error logs and check
5:14:15 PM  [Apache]    the Windows Event Viewer for more clues
5:14:15 PM  [Apache]    If you need more help, copy and post this
5:14:15 PM  [Apache]    entire log window on the forums

我试图在浏览器中查看 index.html 文件,我使用这个 URL:http://localhost/xampp/htdocs/project/index.html但我得到一个空白页面,在控制台中显示此消息:

GET http://localhost/xampp/htdocs/project/index.html 404 (Not Found)

有什么解决办法吗?

最佳答案

您尝试导航到的 URL 不正确。它应该是 localhost/project/index.html#/。基本上,xampp 在您的系统中设置一个服务器(apache 和其他)。您的项目文件(如 index.html)应位于 xampp\htdocs\YourFolderName 中。

浏览器将服务器定位在 localhost 中,并将在上述文件夹中搜索其中可用的任何资源。所以上述情况的 url 将是 localhost/YourFolderName/index.html#/

关于javascript - 使用 XAMPP 的 AngularJS 找不到页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44973071/

相关文章:

javascript - $.inArray 深度搜索

apache - mod_rewrite 用于友好的 URL

apache - Passenger Standalone,不需要HTTP Server?

javascript - Javascript 中的对象原型(prototype)属性

javascript - 其他 3 个 div 中的一个。当其他人看不见时,它就会出现。 (按下按钮时)

javascript - Express.js - 如何修改路由中的 app.locals 变量

javascript - jquery jTable 中的表单布局?

javascript - Angular js : how to orderBy an array without keys?

javascript - 处理空查询选择器

apache - 本地开发服务器上的 ssl