How to create a 410 page in wordpress

7 replies
Hi,

Does anybody know how I can create a 410 page in wordpress? I am able to add and edit template files etc. I looked on Google but I found nothing I can use.

My site was hacked and now I have some pages indexed that need to return a 410 error, because those pages do not exist. Is there something I need to add to my template or functions.php to ensure it will work.

I prefer to not use a plugin for this function.

Thanks in advance,
Hans
#410 #create #page #wordpress
Avatar of Unregistered
  • Profile picture of the author Artur Golisz
    So you need a plugin where you can add url which should return 410 (http status)?
    Signature
    Need help with programming (WordPress, PHP, jQuery and more) ? Just send me PM.
    {{ DiscussionBoard.errors[9151495].message }}
  • Yes, But how can I do that without a plugin?
    Signature

    Hans and Merlijn present to you:

    www.planningtosuccess.com

    {{ DiscussionBoard.errors[9151658].message }}
  • Profile picture of the author RobinInTexas
    Why not just let WordPress return a 404 error? There's no advantage in using a 410.
    Signature

    Robin



    ...Even if you're on the right track, you'll get run over if you just set there.
    {{ DiscussionBoard.errors[9153303].message }}
    • Profile picture of the author dccharron
      Actually there is a huge difference between 404 and 410. When a web crawler gets a 404, it logs the error. When a web crawler gets a 410, it logs the error and removes the page from its index. So a 404 gets repeated over and over by the crawler. A 410 only happens once.

      There's a plugin for wordpress called "410 for Wordpress". I use it and it works. I tailored the response to look like the one generated by a 404 by copying the 404.php file and tinkering a bit with it. I'd recommend.
      {{ DiscussionBoard.errors[9530921].message }}
  • Profile picture of the author newgadget123
    we can create 410 page in wordpress by using a
    plugin that sends http 410 responses to requests for pages which are no longer exist on your site.
    {{ DiscussionBoard.errors[9547339].message }}
  • Profile picture of the author mralexanderca
    You can simply modify the header information via header('...'); clean the output buffer, set the appropriate header and exit();

    Hope this helps.
    {{ DiscussionBoard.errors[9548263].message }}
  • Profile picture of the author nofame
    I have a solution that doesn't rely on plugins.... this can be handled outside of wordpress at the server level.

    1. Edit .htacccess and add the "gone" directive for every URL you want to 410:

    Redirect gone /mexico
    Redirect gone /viagra
    ... etc.

    2. Then setup a custom 410 error document:

    ErrorDocument 410 /missing410.html

    3. Then make a simple themed document and place it in your root directory (name it missing410.html). I just loaded copy/pasted the source code from my homepage and cut out everything in the header and body, and added some content to it. Just make sure it has a page title of 410 Gone and an H1 410 Gone, then you can tell users to click on the sidebar / search / etc. Your server will serve the custom 410 page along with the 410 HTTP headers that tells search engines the resource is gone.
    {{ DiscussionBoard.errors[11204694].message }}
Avatar of Unregistered

Trending Topics