410 status code woes in cpanel

i was recently having trouble setting a 410 status code on a url that is no longer available on my wordpress install. according to apache’s documentation on mod_alias, use the redirect directive to set a 410 status code on any url on your server. so, i did that however my server kept returning a 404 status code.

after a bit of searching, i came across this post about the same problem i was having. the author states that cpanel, the administration panel used by many hosting companies, conflicts with the directives generated by wordpress when permalinks are saved.

WordPress Htaccess Directives

to get around that issue, you need to define the default page that is returned by the server when the error is issued. below is what your .htaccess file would look like with a properly configured 410 status code.

errordocument 410 default
redirectmatch 410 /<url>

replace <url> with the location the url that will return the 410 status code. upload the new file to your server and check the header for the 410 status code to be delivered.

410 Status Code

using a 410 versus a 404 status code

someone may be asking, “why go through the effort of setting a page to return a 410 instead of using the default 404?”.

as john mueller points out, google does treat a 410 slightly different than a 404. much like a permanent redirect, the 410 tells google that the page has been permanently removed and to quickly remove it from its index. a 404, on the other-hand, resembles a temporary redirect. it tells google that the page may return in the future but for right now it’s not accessible.

Leave a Reply

Your email address will not be published. Required fields are marked *