路径包含多个斜线时找不到HTTP 404页面

问题描述

嗨,我写了一个小路由器,它接收url并解析数据,然后向用户显示所需的页面。它工作正常,每次我写“ localhost / page-that-doesnt-exist”之类的内容时,它都会显示我的错误页面,并将http响应代码设置为404。当我尝试“ localhost”之类的问题时/ page-that-doesnt-exist / something”。如果仍然显示我的错误页面并发送404代码,但问题是我的布局不收取我的styles.css文件...因此,我的导航栏和所包含的错误页面未设置样式。

In the console when I type "localhost/page-that-doesnt-exist"

GEThttp://localhost/ff
[HTTP/1.1 404 Not Found 17ms]

And when I type "localhost/page-that-doesnt-exist/something"

GEThttp://localhost/ff/css/styles.css
[HTTP/1.1 404 Not Found 4ms]

But if I type "localhost/page-that-doesnt-exist#/something"

GEThttp://localhost/ff#/ff
[HTTP/1.1 404 Not Found 15ms]

That works,even if I type  "localhost/page-that-doesnt-exist#/something/something/more..."
Cause of the "#"!!!

显然,它采用了我在url中键入的路径,但该路径不存在,然后尝试从此处而不是从根目录中包含我的styles.css文件。为什么?

非常感谢您。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)