Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Apache 2.2 (on a server running cPanel) seems to be ignoring instructions to return a 410 status.

This happens for both mod_alias's Redirect (using 410 or gone) and mod_rewrite's RewriteRule (using [G]), being used inside a .htaccess file.

This works:

Redirect 302 /somewhere /gone

But this doesn't:

Redirect 410 /somewhere

That line is ignored (as if it had been commented) and the request falls through to other rules (which direct it to an unrelated generic error handling script).

Similarly, trying to use a RewriteRule with a [G] flag doesn't work, but the same rule rewriting to a script that generates a 410 does - so the rules aren't the problem and it seems instead to be something about 410/gone that isn't behaving.

I can workaround it by having a script sending the 410, but that's annoying and I don't get why it's not working.

Any ideas?

share|improve this question
up vote 4 down vote accepted

There appears to be a bug in cPanel - it requires an explicit ErrorDocument for the 410 to take effect.

So, the solution is to add the following to the .htaccess:

ErrorDocument 410 default

This then enables the [G] to work for RewriteRule. (Have not yet verifited that Redirect is fixed also.)


share|improve this answer

What do you mean by saying that it doesn't work, what status code is returned? If you're using any third-party apache modules try disabling them first.

share|improve this answer
It acts the same as it would if I put a # in front of the instruction (i.e. it is ignored). The server is running cPanel so has any third-party modules that cPanel has by default, but disabling them is not an option (nor is any other blind config changes that may affect other sites). – Peter Boughton Nov 3 '12 at 22:50
Try checking the http status code with the help of: HttpFox addon (firefox) or Chrome developer tools (Control - Shift - I, Network tab) – FINESEC Nov 3 '12 at 23:02
Status code is irrelevant here - the line is being ignored. It appears there's an issue with cPanel, which requires an explicit ErrorDocument directive to be specified - see my answer for details. – Peter Boughton Nov 3 '12 at 23:07
Status code is relevant. You should probably always check it in the first place when you have other problems like this one ;-) – FINESEC Nov 3 '12 at 23:14
I was checking it - I had the network tools active in two browsers whilst I was setting up and then debugging the config. The request was being passed to the webapp when it should not have been, and thus the entire response (including status) was irrelevant - GIGO. – Peter Boughton Nov 3 '12 at 23:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.