WordPress Plugin: 404 Simple Redirect

You can download my WordPress Plugin: 404 Simple Redirect clicking here.

What does the plugin?

This plugin hooks the normal WordPress workflow in order to determine if the request is processing will cause a 404 HTTP error. In that case it prevents WordPress to do any other processing and sends the user to the page defined in the plugin options.

How do I install de plugin?

Just download it from the WordPress plugins repository, activate it and enjoy!

Plugin info

Current version: 1.2
Author: Jordi Plana
Release log:

1.2

  • Fixed empty URL bug +info
  • Added localization

1.1

  • Fixed typo errors
  • Added settings link from plugin page

1.0

  • First version
Jordi Plana

Jordi Plana

I'm Jordi Plana, a software developer in his late twenties.I've been involved in web development for the past 12 years. It all started with a website dedicated to playing board games when I was a teenager, and since then I had the chance to make websites for all kind of businesses, organizations and individuals.

36 thoughts on “WordPress Plugin: 404 Simple Redirect

  1. I have a white label site. I want to redirect visitors who come from search engines to the white label. I cannot use the white label in the search URL. Is there a redirect plugin that I can build on my site that will zap visitors, without much pain, straight to the white label. I don’t want visitors to stop on my site, just pass by it. Is that reasonable? can it be done?
    Ed C

    1. Hi Ed,
      I think you can do some kind of user redirection based on the referrer.
      There are a lot of different ‘referrer detection’ technics: javascript, php, etc. You will only need patiente and some coding skills.
      Regards!

  2. Hi Jordi,

    First of all, I’m a newbie on webhosting and wordpress.

    I’ve found out your plugin is very simple to implement and I like it. Due to some reading of 301 redirecting may cause duplication read by google and affect search ranking.

    My website will be a property website. Those sold or rented properties will be taken out and I would like them to redirect to main page. Since I dont know much about redirecting a 404 page, will this cause duplication of content? If it won’t, could you enlighten my newbiness =D

    Thx!

    1. Hi Mav,

      Thanks for using the plugin!

      404 Simple Redirect Plugin redirects using a default HTTP 302 header. This 302 status means that the page has temporary moved.

      I think that if the plugin used a 301 HTTP header instead search engines will read the redirection as duplicated content. 301 redirection is the correct way to tell search engines that the content in that URL has been moved definetely to the new one, so with 302 you shouldn’t worry about penalization.

      Another interesting thing would be keeping that old property pages, they may add you some page thickness and search engine visitors. Think about how can you keep this pages in order to keep visitors coming from crawlers.

      There have been lots of discussions on how do search engines treat 302 redirections, I leave here some interesting links about it:

  3. Hola, te escribo porque el plugin me encanta por ser tan sencillo y funcional. El caso es que en mi sitio también uso Google Search en el sitio y cuando hago cualquier tipo de búsqueda en vez de darme algún resultado me manda a la página que utilizo para la redirección del plugin. Incluso probe a cambiar la redireccion a otra URL pero no funciona, la web no me muestra los resultado de búsqueda.

    Sabes a que se puede deber?

    Gracias y un saludo.

    Cento

    1. Hola Centro,
      Gracias por utilizar el plugin.

      Este comportamiento que me comentas es muy inusual. Si te está redirigiendo a la página configurada en las opciones del plugin es porque la petición de la página que va a servir WordPress genera un código de error 404.

      Utiliza Firebug o Chrome Inspector en la pestaña de Red para averiguar a qué URL está atacando la petición POST que envía el formulario de búsqueda. Es posible que esa URL sea errónea, o WordPress no sepa interpretarla (debido a estructura de permalinks por ejemplo) y esté causando el error 404 que te comento.

      Espero haberte ayudado.

      Un saludo

    2. La cuestión es que cuando lo desactivo (el plugin) todo funciona correctamente, por eso no entiendo el comportamiento, porque en principio los resultados, al meter una busqueda es extraño que de error 404 ya que es google search cuyos resultados los tengo predeterminados en una pagina especifica de mi blog.

      No se si sabes como va la configuración de Google Search o si se puede meter un condicional al plugin o algo.

      No se si me explico.

      1. Hola Cento,
        Por lo que veo en tu página el formulario de búsqueda es incorrecto. La action que tiene assignada actualmente es: todoiphone.net/resultados-de-la-busqueda cuando debería ser http://todoiphone.net/resultados-de-la-busqueda. Fíjate que la URL debe contener http://, en caso contrario interpreta que se trata de una ruta relativa (y no debería contener la URL base de tu sitio).

        Cambia este valor en tu template y verás que funciona correctamente. Yo he hecho la prueba via Firebug y ha funcionado.

        Coméntame si solucionaste el problema.

        Un saludo

        1. La verdad que he realizado la prueba y ha funcionado correctamente, lo extraño es que el código que tenía puesto yo lo había generado google, el caso es que no estaría mal que lo pusieras en las FAQS.

          Por cierto, ya lo he dicho, pero excelente trabajo con el plugin.

          Me encanta. Las herramientas para web masters de Google me limpio de errores de un día al otro.

          Gracias!!!

  4. Hello
    First of all I want to thank you for great plugin that you brought.
    He works perfectly, but…..

    I have a problem
    On my blog I use:
    404 simple redirect plugin and another redirect plugin for my external links.

    So that plugin makes external links like http://www.mysite.com/****/http://external link/
    where ***** – prefix which I set in the external links plugin settings.

    And when i click on some external link, 404plugin redirect me to my home page(mysite.com/home.php- the page that is specified in the 404plugin settings)

    My question is: how create the exception in the 404plugin options form for links like /****/http://external link****/

    Sorry for my bad english.

    1. Hello Questionman,
      Thanks for using the plugin.

      Can you please tell me which other plugin do you use for external redirections. I would like to test how do the two plugins work.

      Regards

        1. Hello Questionman,
          I downloaded the plugin you told me. The (J)ExR plugin triggers the redirection on template_redirect action. This action takes places after wp action, which is used by 404 Simple Redirect to do the redirection.

          You should try to change line 310 of (J)ExR plugin.

          Change this:
          add_action('template_redirect', 'j_global_redirect');

          Into that:
          add_action('wp', 'j_global_redirect', 9);

          Tell me if you solved your problem.
          Regards

  5. Adding update to my previous comment.
    I wrote to Arnan De Gans, the AdRotate plugin developer and he suggested to make an exception to 404 SR to not intercept AdRotate redirections, what about?

  6. Great Plugin!

    Is there any way to see a log of what redirections were executed? and if so, does your plugin work with other redirectors?

    I have tried a few redirect plugins, however your plugin takes the precedence and executes before any other plugin has a chance to log it.

    My theory is that if you can detect the error and display it, then I can use another redirector to fix the error or fix my site.

    Thank you for your consideration.

    -AJ

  7. Hello,

    thank you for great plug-in, but unfortunately it’s not working (or working too good) with “WP No External Links”. Every external link that is cloaked will be redirected to url placed in “404 Simple Redirect” settings.
    Can you help me with that?
    I turned off “404…” for now.

    Maybe you can also add option to add more redirect links, so users can be redirected to random link from link list?

    Best regards

    1. Hi Shahzad,

      When the plugin is deactivated it does not perform any redirection. If the behaviour is still persisting must be because of other plugins. If you use any caching plugins I suggest to have a look on them, and purge the cache.

      Thank you,
      Jordi

  8. I installed your plug in and redirected about 60 links for this website: tekbar.net.
    But when I go to ahrefs, it only shows a couple of active links. The rest are still listed as 404 links.

    I do the following:

    1) find the plug in under settings
    2) manual install the url in question
    3) identify the post I want the link to redirect to.
    4) I do the 301 permanent redirect.
    5) the plug in says that the redirect was added successfully.

    It seems I am doing it correctly but why does ahrefs not show the links being redirected?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>