如何设置Apache返回204代码? [英] How do I setup Apache to return a 204 code?

查看:75
本文介绍了如何设置Apache返回204代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置Apache返回某个URL的204(无内容)而不是404代码?

How do I setup Apache to return a 204(no-content) instead of a 404 code for a certain URL?

推荐答案

将Redirect文档与RedirectMatch文档放在一起,可以看到,可以将自定义204发送回去.这是一个简单的示例,该示例以204响应任何与foo匹配且后跟任何字符的请求.

Putting together the Redirect documentation with the RedirectMatch documentation, we see that yes, we can send a custom 204 back. Here is a quick example that responds with 204 to any request matching foo with any characters after it.

 #RedirectMatch example using mod_alias 
 RedirectMatch 204 foo(.*)$

从这里 http://www.lowlevelmanager.com/2009/07/returning-apache-204.html

这篇关于如何设置Apache返回204代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆