Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I setup Apache to return a 204 code?

Tags:

apache

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

like image 511
Robert Gould Avatar asked Apr 28 '10 22:04

Robert Gould


1 Answers

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(.*)$

from here http://www.lowlevelmanager.com/2009/07/returning-apache-204.html

like image 185
Robert Gould Avatar answered Sep 20 '22 13:09

Robert Gould