• Resolved cjvannette

    (@cjvannette)


    The obvious answer is “it works well.” ?? But what is it actually doing?

    I ask because I’m trying to understand more about WordPress and 301 redirects, and I can’t find anything in the codex. My attempts to use the traditional .htaccess file edits were a frustrating failure. I’m really glad this plugin works, but in case it breaks some day, what’s the underlying process?

    https://www.ads-software.com/extend/plugins/simple-301-redirects/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Scott Nelle

    (@scottnelle)

    Black magic. ??

    Actually, the way it works is like this:
    # All of the redirects are serialized and stored in a single option called 301_redirects in the wp_options table.
    # On each request, WordPress reads that option prior to running anything but the core, loads the results into an array, and checks to see if the current request is in the array.
    # If the request matches one of your entries, it writes a 301 Permanently Moved header to the visitor’s browser using PHP. If there’s no match, it passes the request along to be processed in whatever way WordPress thinks is best.

    It’s unlikely that this plugin will ever break because it’s so simple and because other than looking up the option data it doesn’t really rely on WordPress functionality–the comparison work and the redirect header are handled in plain old PHP.

    If you do ever have problems with it, or just want to go with the fastest option available, here’s a post from the WP support site that might be helpful in getting redirects to work in .htaccess: https://www.ads-software.com/support/topic/proper-301-redirect-in-htaccess

    Scott

    Plugin Contributor Scott Nelle

    (@scottnelle)

    For anyone who may be wondering, by the way, the first version of the plugin used https://codex.www.ads-software.com/Function_Reference/wp_redirect to send the redirect headers but several users reported that on their server it ignored the instructions and instead returned a 302 Redirect Header. That’s why the plugin no longer uses the built in WordPress functionality for redirects.

    Thread Starter cjvannette

    (@cjvannette)

    Thanks, Scott! Do you know if this sort of redirect looks the same from a search-engine bot’s perspective? My SEO guy is the one who started this whole URL-changing rigamarole.

    Plugin Contributor Scott Nelle

    (@scottnelle)

    The requesting browser (or in the case of a search engine, spider) sees the same header regardless of the method used to generate it, so these redirects will be treated by search engines the same way that .htaccess redirects are.

    There is a fraction of a second of lag time while the WordPress core initializes and the request is checked so .htaccess is still the fastest and best method to use if it’s available to you.

    Thread Starter cjvannette

    (@cjvannette)

    Oh, goody. Still not sure why I couldn’t get the .htaccess method to work, but your plugin is prettier anyway. ??

    Scott, thanks for your work on this plugin.

    With the latest versions of WP (3.3.1), is there a possibility of incompatibility? What we’re experiencing is that every now and again, our site will stop responding or lag quite a bit … no other crazy plugins installed or external resources are being loaded.

    Quick thoughts?

    Plugin Contributor Scott Nelle

    (@scottnelle)

    Hey dColumbus,
    It works in my testing. What the plugin actually does is very simple (one database query and then stepping through an array of URLs) so it’s unlikely to be causing serious performance issues. I’d advise temporarily shutting the plugin off to see if it resolves the performance issues. If you determine that it is definitely the plugin, check with your web host about setting up your redirects in .htaccess instead. Like I said, though, I don’t think the plugin is causing the issue. If you find otherwise, please let me know. ??

    Scott,

    Have you ever run into the “310, Too many redirects” issue before? When trying to access my site through the HTTPS protocol, I get the 310 error. I’ve disabled your plugin (even though I don’t think it has anything to do with it) and there’s no difference…

    Any ideas?

    Plugin Contributor Scott Nelle

    (@scottnelle)

    The only time I’ve run into that was when I had WordPress incorrectly configured when set up with a WP Multisite setup. I’d suggest turning off each plugin one at a time to see if you can narrow down the issue. If it still happens, make sure that the domain settings for your WP setup match the other settings stored in the Database like Homepage URL.

    Is this plug in compatible with WordPress SEO?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Simple 301 Redirects: How does this plugin work?’ is closed to new replies.