标签: http-status-code-404

问题重定向403禁止404找不到

我的.htaccess的相关部分看起来像这样:

Options -Indexes
<FilesMatch include>
    Order allow,deny
    Deny from all
</FilesMatch>
RedirectMatch 404 ^/include(/.*)$
Run Code Online (Sandbox Code Playgroud)

它产生了以下响应:

  • /包括403
  • / include/404
  • /include/config.inc 403

我可以通过查看我的模式来判断问题可能出现在(/.*)部分,但我尝试的所有内容都给出了相同的结果; 而不是一直得到404我得到一个404的404和其他一切的403.我正在使用的表达式有什么问题?或者,因为我必须为几个目录执行此操作,是否有一种全面的方法可以将所有403响应转换为404?

更新:我发现通过删除FileMatch我得到了更好的结果,所以我的.htaccess现在看起来像这样:

Options -Indexes
RedirectMatch 404 ^/include(/.*)?$ # Added dlamblin's first suggestion
Run Code Online (Sandbox Code Playgroud)

并生成以下响应:

  • /包括404
  • / include/404
  • /include/config.inc 403

更新:有趣的是,我发现以下产生不同的输出:

RedirectMatch 404 ^/include(/?|/.*)$
RedirectMatch 404 ^/template(/?|/.*)$
Run Code Online (Sandbox Code Playgroud)

模板模式适用于所有情况但是include仍然为include中的所有文件生成403(例如/include/config.inc)这可能是目录名称的问题而不是.htaccess文件本身的问题?

更新:访问/include/config.inc时,我的.htaccess中的以下内容与重定向冲突.

<FilesMatch config>
    Order allow,deny
    Deny from all
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)

apache .htaccess mod-rewrite http-status-code-403 http-status-code-404

6
推荐指数
1
解决办法
3万
查看次数

URL中的HTML和CSS导致404错误(用户代理= Trident/4.0)

我已经在URL中获得了一些带有代码片段(CSS,HTML和JavaScript)的404.

尽管我可以告诉用户在他们的会话期间正在通过网站正常进展 - 它是一个电子商务网站,受影响的用户正在把东西放在他们的篮子里并检查确定等.

在某些页面上,我看到404错误与看似成功的页面显示相邻.每次显示该页面时(在该会话中),我都会收到相同的404错误.

记录的404错误示例:

404;http://www.example.com/rrepeat: repeat-y;
Run Code Online (Sandbox Code Playgroud)

在页面上有一个匹配的实例(除了第一个"r"):

<td style="background-image: url(/i/lb_ccccccbrd.gif); background-repeat: repeat-y;">
Run Code Online (Sandbox Code Playgroud)

我检查了包含的CSS文件,没有匹配(假设他们这样做,我会在包含CSS文件的所有页面上获得404)

我的想法是,它可能是IE8的插件,它在用户正在查看它以缓存某些内容时抓住页面 - 或者可能出于更恶意的目的.页面的用户代理和404(在该会话中)是相同的[不知道插件是否会对浏览器本身显示不同?]

其他例子:

/r/table&gt;&lt;/form&gt;&lt;/td&gt;&lt;td width= 
/r width=

/r alt= 

/rurn pair[1]; --&gt;</SPAN> --&gt;</SPAN>--&gt;</SPAN>function Set_Cookie( name, value, expires, path, domain, secure ) <SPAN style="color:red;font-weight:bold;background-color:yellow;">&lt;!--/ set time, it's in millisecondsvar today = new Date();today.setTime( today.getTime() );/*if the expires variable is set, make the correct expires time, the current script below will set it for x number of days, to make it for hours, delete * 24, …
Run Code Online (Sandbox Code Playgroud)

javascript cookies user-agent internet-explorer-8 http-status-code-404

6
推荐指数
1
解决办法
1905
查看次数

如何在IIS 6.0上部署WCF服务

我在Windows Server 2003上安装了IIS 6.0.

我安装了.NET 3.5和4 beta 2."正常"ASP工作正常(完美).但是当我尝试导航到我的服务(/myServer/MyService.svc)时,我得到了404.找不到页面.

确切地说,我得到了一个404 2"Web服务扩展锁定策略阻止了这个请求."

我曾经ServiceModelReg.exe /ia确保我知道的扩展名并使用以下方法检查了配置:

admin-Tools,iis,home-tab,配置,可执行文件框,以及:

扩展名:.svc,路径:c:\windows\microsoft.net\framework\v4.0.210...,动词:所有动词.

所以一切似乎都好.但我仍然得到404-2.

deployment wcf iis-6 http-status-code-404

6
推荐指数
2
解决办法
1万
查看次数

Tomcat blankpage为默认错误页面

首先,我正在使用Tomcat 5.5和我的.jsp在/webapps/foo/bar/*.jsp中.

我按照此处的说明设置了默认的404错误页面.在我输入的TOMCAT_HOME/conf/web.xml中:

    <error-page>
    <error-code>404</error-code>
    <location>/error.html</location>
    </error-page>
Run Code Online (Sandbox Code Playgroud)

我将测试error.html文件的副本丢弃到每个dirs中(我不确定/error.html指的是哪里):

/webapps/
/webapps/foo/
/webapps/foo/bar/
Run Code Online (Sandbox Code Playgroud)

每当我尝试在url的/foo/missingpage.html或/foo/bar/missingpage.html浏览器中访问不存在的页面时,我都会被重定向到/foo/error.html中存在的错误页面.

但是,尝试在url /missingpage.html的浏览器中访问不存在的页面会产生空白页.或者/missingDir/missingfile.html的任何排列也会产生一个空白页面.有什么建议?我错过了一些额外的配置吗?

谢谢

PR

tomcat http-status-code-404

6
推荐指数
1
解决办法
1万
查看次数

在Umbraco的404页面?

我安装了Umbraco 4.5,运行正常.有一件事我不能去工作,是404.当它点击一个不感兴趣的页面时,它显示默认的IIS7 404页面,而不是内置的umbraco 404页面.

所以我认为这是我必须改变的一个环境 - 但是哪个?

iis umbraco http-status-code-404

6
推荐指数
1
解决办法
6570
查看次数

Eclipse,tomcat,404错误

我正在学习servlet并遵循本教程(我一步一步地遵循,但我将项目命名为"SampleServlet"而不是"de.vogella.wtp.filecounter").当我启动服务器(步骤5.4)时,我收到404页面错误:

HTTP Status 404 - /SampleServlet/servlet/de.vogella.wtp.filecounter.servlets.FileCounter
type Status report
message /SampleServlet/servlet/de.vogella.wtp.filecounter.servlets.FileCounter
description The requested resource (/SampleServlet/servlet/de.vogella.wtp.filecounter.servlets.FileCounter) is not available.
Run Code Online (Sandbox Code Playgroud)

从哪里开始调试?服务器启动时,控制台中有几个"INFO",一个警告:

29.08.2011 21:03:44 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SampleServlet' did not find a matching property.
Run Code Online (Sandbox Code Playgroud)

我需要更改任何偏好吗?

java eclipse tomcat servlets http-status-code-404

6
推荐指数
2
解决办法
1万
查看次数

如何捕获Http.Conduit的simpleHttp抛出的404状态异常

我正在尝试下载html文件中包含的所有png文件.我很难捕获404状态异常,而我的程序只是崩溃了.

以下是一些示例:

import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy as L

main = do
    let badUrl = "http://www.google.com/intl/en_com/images/srpr/WRONG.png"    
    imgData <- (simpleHttp badUrl) `catch` statusExceptionHandler  
    L.writeFile "my.png" imgData

statusExceptionHandler ::  t -> IO L.ByteString
statusExceptionHandler e = (putStrLn "oops") >> (return L.empty)
Run Code Online (Sandbox Code Playgroud)

我的"oops"消息从不打印,而是应用程序崩溃:

StatusCodeException(Status {statusCode = 404,statusMessage ="Not Found"})[("Content-Type","text/html; charset = UTF-8"),("X-Content-Type-Options","nosniff "),("日期","星期五,2012年1月27日03:10:34 GMT"),("服务器","sffe"),("内容长度","964"),("X-XSS -Protection","1; mode = block")]

我究竟做错了什么?

更新:

根据Thoma的建议,我将代码更改为以下代码段,现在已经适当地处理了异常处理.

main = do
    let badUrl = "http://www.google.com/intl/en_com/images/srpr/WRONG.png"    
    imgData <- (simpleHttp badUrl) `X.catch` statusExceptionHandler  
    case imgData of x | x == L.empty -> …
Run Code Online (Sandbox Code Playgroud)

haskell http-status-code-404 http-conduit

6
推荐指数
2
解决办法
1400
查看次数

发送404或410是否是犹太教,但仍显示内容?

在过去的几天里,关于Meta的删除问题进行了大量讨论.一个提出如何处理删除现在被视为偏离主题的问题的建议向所有人展示了一些流行的删除问题 - 灰色外观是10k +用户在查看已删除的问题时得到的.

在这种情况下,背景是灰色的,没有可能的交互,但所有内容仍然可访问:

在此输入图像描述

我建议页面可以同时发送一个404 not found或者410 gone如果压倒性的愿望是将它们从搜索索引逐步发出.

因此将显示内容,但会发送4xx状态代码.

然而,有一个批评这个想法的评论:

嗯,为什么在公开链接时发送404?你打破了404代码的语义

我倾向于不同意:响应体中显示的内容(为了满足我们人类的好奇心)并不重要,是吗?机器可以使用4xx.

谁是对的?

http http-status-codes http-headers http-status-code-404 http-status-code-410

6
推荐指数
1
解决办法
268
查看次数

在IIS 7中为HTML页面设置自定义404页面

我的网站是.htm扩展名,服务器是IIS 7.我现在设计自定义404页面.

现在任何人都可以建议我,如何通过web.config实现自定义404页面.

iis-7 http-status-code-404

6
推荐指数
2
解决办法
1万
查看次数

Angular4为存在且公开服务的json数据提供404

我有一个用Angular4编写的测试数据服务.它目前看起来像这样:

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';

import 'rxjs/add/operator/map';

import 'rxjs/add/operator/toPromise'


@Injectable()
export class DataService {

  constructor(private http: Http) { }

fetchData(){
  return this.http.get('https://dinstruct-d4b62.firebaseio.com/.json').map(
    (res) => res.json()).toPromise();
}

}
Run Code Online (Sandbox Code Playgroud)

感谢这个代码的"网络忍者",因为该应用程序的这一部分基本上与教程代码完全相同(我更喜欢在构建新应用程序时有一些应该是用于测试目的的已知工作示例). .

问题是虽然在https://dinstruct-d4b62.firebaseio.com/.json上肯定存在测试数据,但就我所知(可通过浏览器直接访问)而言,它并未以任何方式隐藏或防火墙,应用程序进入该fetchData()功能,它记录:

    ERROR Error: Uncaught (in promise): Error: Response with status: 404 Not Found for URL: https://dinstruct-d4b62.firebaseio.com/.json
Error: Response with status: 404 Not Found for URL: https://dinstruct-d4b62.firebaseio.com/.json
Run Code Online (Sandbox Code Playgroud)

在堆栈跟踪的开始.这可能会发生什么?

更新:

我也注意到在调用函数中:

ngOnInit(): void {
  this.customerService.getCustomers()
      .then(customers => this.customers = customers);
  this.dataService.fetchData().subscribe( …
Run Code Online (Sandbox Code Playgroud)

json http-status-code-404 firebase typescript angular

6
推荐指数
1
解决办法
1986
查看次数