Groups 404 Redirect


Download

Download the free Groups 404 Redirect plugin for WordPress.


Description

This plugin redirects 404′s caused by hits on pages that are protected by Groups.

The redirection settings can be adjusted in Settings > Groups 404 :

Visits to protected pages can be redirected to:

  • a specific post, or
  • the WordPress login

The redirect status code can be selected among:

  • Moved Permanently (301)
  • Found (302)
  • See other (303)
  • Temporary Redirect (307)


Installation

  1. Upload or extract the groups-404-redirect folder to your site’s /wp-content/plugins/ directory. You can also use the Add new option found in the Plugins menu in WordPress.
  2. Enable the plugin from the Plugins menu in WordPress.
  3. Go to Settings > Groups 404 and adjust the redirection settings as desired.


References

84 comments

  • I’m using your Groups plugin with the WooCommerce Groups extension on a development site. So far it’s working great on my development site. Today I installed the Groups 404 plugin, but cannot get it to redirect to a specific postID or login page with any of the redirection options.

    I think the way Genesis handles 404 errors is the issue rather than any problem with the Groups 404 plugin. Others using Genesis may encounter the same problem. I’m going to see if the Genesis Widgetized and Not Found plugin can help. Would have been easier to use Groups 404!

    As a workaround for restricted blog posts, I’ve added a non-restricted post to the archive explaining that user would see more posts if they were logged in as a member. Thank you.

    • Thanks for sharing that, could you try the following and let me know if it works?

      Try to override Genesis’ redirection by letting the plugin act earlier, for example:

      In groups-404-redirect.php line 44 says:

      add_action( 'wp', array( __CLASS__, 'wp' ) );

      Substitute it with:

      add_action( 'wp', array( __CLASS__, 'wp' ), -1000 );

  • Good thought, but it didn’t work for me. I also tried adding the following line in the redirection section of the plugin, but without success:

    remove_action( ‘genesis_loop’, ‘genesis_404′ );

    As a workaround, I’m using the 404-widget with added text about members-only content, so I will continue to use the WC Groups plugin to restrict access.

    I’ve tried using a custom 404 but it didn’t help with the redirection.
    Thank you for your time. If I discover anything useful, I’ll share it.

  • Thank you. I know you’re busy and appreciate your looking into usage with Genesis.

  • David Anthony

    Hello there,

    Your plugins are fantastic.

    The Groups 404 isn’t working for me either. The post title is showing in the backend, indicating that I have entered a proper post ID, but it isn’t redirecting. Just displaying the 404 not found error

    Thank you so much for your time and I apologize for the inconvenience, but is there any way you can help me to make it work? My theme was built on Arturo framework if that helps at all.

    Thank you again.
    David

    • Thanks David :)

      I’d be happy to have a look at that as well, I don’t have a copy of that theme but we can ask the author if he would cooperate to see what’s happening. Are you in touch with him?

  • I’m using your Groups plugin with the WooCommerce Groups extension on a Woo Themes site, and cannot get the Groups 404 plugin to redirect to a post or the login page.

    Any suggestions? Thanks

  • I was able to get it to work on:

    http://www.seniorsignite.com

    I didn’t do anything different – it just started working today. It’s still not working on http://www.hifisocialwebmarketing.com

    Maybe this just has something to do with hosting – I host on ZippyKid. I setup a test site on zippykid, disabled all plugins except for groups and groups 404, and could not get it to work.

    Setup test site on bluehost and it works just fine.

    thanks for the plugin.

    • Hi Nancy,

      Thanks for trying it out and I’m glad you have it working now. It could also have been related to caching (I found myself wondering when testing another plugin for a demo site where WP Supercache had been enabled and had to be completely removed before things started working again).

  • My test shows the problem not redirecting is due to the permalink enabled and the post is custom type.
    Both of these return $current_post_id = 0
    $current_post_id = url_to_postid( $current_url );
    current_post_id = $wp_query->get_queried_object_id();

    As far as I can tell, url_to_postid will not work on custom post type. I am assuming get_queried_object_id suffer the same issue.

    When I disabled permalink, the redirection works.

    So, I am unable to find a solution.

    • Thanks for reporting this Robert, I’ve added an alternative function that will find the post also for CPTs and pretty links. Will release it today :)

  • Hello all,
    I have tracked down to this function
    Groups_Post_Access::public static function user_can_read_post

    If the user doesn’t have read access the function will return false. It looks like the function is also triggered for unregistered view a restricted post. The url_to_id functions always return 0. This means, we won’t able to find out the post_id either.

    • Hi Robert,

      Please try release 1.1.0 (just out a few minutes ago) which should also work fine now with what you described earlier, let me know in case you still have issues with it.

      Cheers

  • Kento,
    It works perfectly. Thank you very much for your help.

  • I’m currently trying to use this but I get no 404 redirect to work currently.

  • Hi

    Using the plugin (with WooCommerce Groups and WooCommerce Subscriptions) but can’t get it to work. The browser (Chrome, Firefox) just times out with an error, e.g. Chrome displays a page saying “This web page has a redirect loop”, instead of redirecting to a post/the login page. Please advise.

    Thanks.

  • Hi there
    I managed to get this working really well on my local bitnami development site, but am struggling to get it to work on my live site.
    I have a lot of posts / pages and the page id is 5035, would this make a difference.
    Any help would be appreciated.
    Interestingly I was the person who posted to have the redirect a month or so ago.
    Thanks

  • I managed to get it to work again by uploading the original files I was using on a local Bitnami installation.

  • alaska

    I set to redirect to login page with page id 110. Now I cant even login to wp-admin. Please urgent help required. The redirect status was set to Temp redirect. I get followng error:
    The webpage at http://www.mywebsite.com.au/cms/login/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
    Learn more about this problem.

    I cleared cookies still no help.
    Error code: ERR_TOO_MANY_REDIRECTS

    • antonio

      Hi,
      please try redirect to a “public” post, maybe you are redirecting to a “protected” post, and you are in a loop.
      If you can’t login to dashboard, you can delete Groups 404 Redirect plugin folder, and try again.

  • alaska

    Dear antonio,

    I did delete the plugin folder, still it gives me same error.
    Login page is not protected its public.

    • antonio

      Seems that the problem isn’t in the plugin.
      If you want you can send us dashboard admin access to support at itthinx dot com, and we’ll have a look.
      cheers

  • Michel

    I installed the Groups 404 Redirect plugin and its partially working as expected.

    When a user clicks on a page/post enabled for a specific group, I have the settings to redirect them to login. Once they are logged in, they can access the group enabled page they clicked on initially. Great!

    If I access some page that doesn’t exist, then our standard 404 page comes up. Great!

    However, if a user clicks on a page/post enabled for a group they are NOT added for. It goes to different page showing the Dashboard, Profile, and Logout links. It would be ideal to forward them to an “Access Deny Page/post” that we can specify. Redirecting to a user profile page is confusing even for me.

    Therefore, how can I setup the plugin to forward to a custom page/custom is the user is not authorized to view that page?

    Thanks!

    • antonio

      Hi,
      you can indicate the destination post/page on Settings->Groups 404.
      cheers

      • Michel

        I did try that, but nothing happens. For example, when a user clicks on a page/post enabled for a group which they are apart of they do not go to the group enabled page/post after they login. Instead they go directly to the page/post that I specify in the Group 404 settings. I’m able to replicate this several times. Please advise? Thanks!

        • antonio

          Hi,
          Sorry, I think I now know what you want:
          When someone access to a protected post, If a user is a guest, then it is sent to the registration page, and if you are already logged in, then sends her to a “Access Deny Page / post”.
          You could fix it, creating an “Access Deny Page / post” using the Pippin’s login shortcode, and redirect with Groups 404 to this page.

  • jnh26

    I am using Groups + Groups Subscriptions + 404 redirect, and when the 404 redirect plugin is activated, the administrative override in Groups no longer works, and administrators are redirected just like other users.

    How can the plugin be fixed so that the Groups administrative override applies to the 404 reidrect plugin also?

    • antonio

      Hi,
      please make sure you have selected “Administrators override all access permissions derived from Groups capabilities.” on Groups->Options.
      If this is selected, please disable Groups 404 Redirect and try again.

      • Jessica

        I deactivated the Groups 404 Redirect plugin, selected the Administrators override in the Groups plugin, and reactivated the Groups 404 Redirect plugin. When I log in as an administrator and visit a protected page, I am redirected as if I don’t have permission to see it.

        In other words, the Group 404 Redirect does not include the administrator override that is in Groups. When I deactivate the Groups 404 Redirect, the administrator override works perfectly.

        • antonio

          Hi,
          if you want, you can send us dashboard admin access to support at itthinx dot com, and we’ll have a look (please indicate this comment in the email).
          cheers

  • Steve

    Hi,

    I’m using this plugin for a multisite where there are already hundreds of users at the network level. I have it set that when a page is restricted, the person is directed to login. However, when you login it redirects you in an infinite loop. I logged in as the admin and the username I was logging into was added to the site, but not added to the Registered group. I’m not sure if there’s a problem with autoadding users to the Registered group or a problem with the login. Any advice would be great.

    Thanks!

    • Hi Steve, do you have any other plugins besides Groups and Groups 404 Redirect activated? If yes, try to deactivate them first and test this again to see if it may be a conflict.

  • Steve

    Kento,

    I just installed Groups and Groups 404 Redirect on a fresh install of WordPress with no other plugins installed or activated. The plugins worked fine on a single site, but when we enabled multi site, we got the same error as before. I network activated both plugins, created a restricted page, then navigated to that page. When I navigated to it, it kicked me to the WordPress login, just like it’s supposed to do. I then registered a user and navigated back to the restricted page to login. When I try to login, it gives an error that the site isn’t redirecting properly. If I can provide any documentation or logs to help, let me know. We are really looking for a plugin that makes it so any registered user on a multisite can access restricted content, and this plugin is very close to doing that, so let us know if there is anything we can do to help. Thanks again.

  • Hi Kento

    Thank you for a great plugin. The groups plugin works great and the groups 404 redirect does exactly what it is meant to do. However it drastically slows everything down when I am editing posts. I keep on losing connection then getting error 500 internal server errors. The server log says the edit php files were not found.

    I disabled all plugins and tried each plugin one at a time until I got to the 404 and this is definitely what is causing the problem. It is vital as with Chrome, users are kicked right off my site onto a search page. IE and FF will give a standard 404 page. However, I would rather have your plugin working.

    Thank you
    Karen

  • Jon

    I set up Groups woo commerce to sell access to a restricted page (a page called movieABC) to watch a streaming video (rental). I also sell this video as a download product.
    I included a url link in the rental product page to the restricted page. (I wish the customer could get this in an email). But this link redirects to the woo commerce product download. For example:

    Link to rent the streaming video (restricted page) http://emptymindfilms.com/movieABC
    This redirects to the catalog page for the download product at http://emptymindfilms.com/product/movieABC

    I cannot get the page called movieABC to show from any link. It always redirects to the catalog product.

    Any ideas really appreciated.

    • antonio

      Hi,
      please have a look to this video.
      - In your “movieABC” product you must select the group to add access (in Groups tab on product edit page).
      - Set access to this group in your movie page.
      - When the user purchase the “movieABC” product, then he has access to the movie page.
      cheers

  • Jon

    I have that part set up. My question is how do I make a link to the restricted page that the customer receives. I set a link in the product advanced tab that the customer see in his accounts page after payment but this link redirects to the catalog – it cannot link to the restricted page.

    It must be paermalinks but still cannot get the link to work.

  • Hello Kento

    I upgraded the 404 re-direct plugin and activated it again, but it still gives error 500 internal server errors when I edit posts. So have to de-activate it when I edit.

    I see you deleted my last comment…?

    Regards
    Karen

  • kad

    Hi guys
    After reading all the comments here and on subscription extension, I still do have one question, i’m a bit confused lol.
    My idea is to have a shop where all visitors can see our products, but only those who have paid a membership can buy them.
    Using subscription + groups + 404, I have 3 groups, registered, paid members and paid member with monthly subscription

    If i restrict the checkout page, visitors can not buy the membership, so it’s obvious that’s not the right way.

    How can configure what follows:
    -The product (membership) can be seen and ordered by all.
    -Other products can be seen but can not be ordered unless the members are already in the paid group (with monthly subscription)

    Thanks and happy new year.

    • antonio

      Hi,
      this code can help you. You must add it to your function.php theme file.
      $productsID contains your products id that you want filter.
      cheers

      • kad

        Thank you very much antonio
        From that code the idea is very clear, so if im not wrong, this is saying:

        the products 18, 119 and 21 (in my case it’s just one id, the membership)
        $productsID = ["18","19","21"];
        can be bought by all and the rest can not unless the members are in group registered
        $group = Groups_Group::read_by_name( ‘Registered’ )

        Is that correct?
        I added the code with my product id’s and groups and having a full white page in admin and frontpage, but it’s ok, ill figure out that,

        Again thanks for the hint of eggemplo_woocommerce_is_purchasable.

        Best regards

        • antonio

          Hi,
          the $productsID are the products that you want to protect (all except membership).
          The white page indicates a code error, if you want, use pastebin.com with your code, and I’ll have a look.
          cheers

          • kad

            Hi Antonio
            Thanks again for the answer

            I copied pasted the code exactly like it is, checked it many times, i just changed the products id and still have a blank page.

            Anyway, I appreciate your involvement, I asked a developer to take a look at it.

            as we plan a promotional shop, we will add new products and delete others every day, so adding ids on a php file may be complicated for the person who will manage the shop.

            Is there a way to make the contrary, to make the membership purchasable and the others no?

            example: membership is id 34, all the rest can not be bought.

            thanks

            • antonio

              Hi,
              maybe a conflict with the versions or another plugin.
              If you need the contrary, you can change:
              if ( in_array($pid,$productsID) )
              by
              if ( !in_array($pid,$productsID) )
              “if not in_array …”
              cheers

  • Great plugin! I’ve used it on a number of sites. One thing we’ve noticed is that restricting access to particular posts works great and the redirect plugin works for individual posts but if those posts are part of a restricted category, the category archive page still shows up with a 404. Any ideas on how to work around that? Thanks for creating a great plugin for WP. You can see an example here: http://dsgnr.ca/1ksw2Bp

  • Steve

    Hi Kento,

    Another question. So using a plugin called Join My Multisite in combination with Groups and Groups 404 Redirect, we were able to get the plugin to work for our multisite. However, we are now having the issue that when users login through Groups 404 Redirect, they are added to the site through Join My Multisite, but they aren’t added to the Registered group. If a user logs in at the network level, then navigates to the specific site, it adds them correctly, but if they login at the site level it does not work. Is there a way to get Groups 404 Redirect to redirect to the network login rather than the site login, or just to a specific URL, or is it limited to the site login? It was working previously, but now for some reason it’s not updating the Registered group correctly.

    Thank you,

    Steve

    • Hi Steve, it shouldn’t make a difference because the appropriate actions seem to be triggered in either case when the user is created. You can redirect to a specific page instead of the WordPress login under Settings > Groups 404.

  • Steve

    Hi Kento,
    I’ve got a few more questions for you. So like I said before, we have a multisite with hundreds of network-level users but very few site-level users. We are using a plugin called Join My Multisite which makes it so logged in network-users that navigate to a site become a user on that site. When these users become a site-level user, they are also added to the Registered group. However, if the user tries to access restricted content and it redirects them to the site-level WP login, when they login they become a user of the site like usual, but they are not added to the Registered group. This does not happen if they go to the network-level login. So I’m wondering, is there a way to get Groups 404 Redirect to redirect to the network-level login? Or a way to get the new site-level users to be added to the Registered group?
    Thanks again.

    • Thanks for the additional info Steve. How exactly do you have Groups installed please? I’m referring to network activated or individually … also would shared groups among the multi sites be a better option?

      • Steve

        I saw that you can redirect to a specific page, but that’s only site-wide correct? The network-level WP login wouldn’t have a page ID on any specific site would it? And you can’t redirect to an arbitrary address, it has to be a page with an ID?
        Groups is installed individually, but I’m not sure if network activating it would make a difference. I can definitely check and get back to you. I wasn’t aware that there was a way to share groups across sites. Could you elaborate?

        Thank you so much.

        • Currently you can’t share groups across sites (multisite), that’s what’s being discussed currently with other users. Give the plugin a try with redirects in multisite and let me know if you have any suggestions please.

  • Jason

    Hi Guys,

    I’m using the 404 redirect and the categories restrict plugins on a site – however the 404 redirect plugin only appears to work for posts/pages that I’ve explicitly set restrictions for on the post edit screen. And not when the post is simply part of a category.

    So for example:
    - If I create a restricted category and then create a new post and assign it to the category, non members get a 404
    - If I create a restricted category and then create a new posts and assign it to the category AND set restrictions on the individual post, non members get the login screen.

    Any thoughts?

    I’m using the latest version of the plugins.

    Thanks in advance.

    • Hi Jason,

      Groups 404 Redirect as it is currently only looks for the current post and redirects if the user doesn’t have access to it. In order to make it work with restricted categories, I’d have to review the plugin and make the appropriate additions so it supports that as well. Basically I think it would be good to have that added, I’ve taken note of this as a feature request and will do that. Thanks for pointing that out :)

      Cheers

    • This has been added to 1.2.0 just released.

  • Where can I find the specific Page or Post ID on the page that I’d like for the redirect to go to?

    Thanks!
    BLee

  • Flick

    Was just going to make a tiny suggestion for a future upgrade if possible… Could you include an option to append the Current URL to the redirected post?

    I am using this plugin and it works great to redirect users without access to a page we’ve created to login (client doesn’t want to use the admin login), however it’d be awesome if on that page I knew where they came from to redirect them back there after they login… So I’ve jumped in and added the redirect code myself, but of course this will be lost with upgrades so thought I’d suggest it!

  • sarah

    Hi, I’m having trouble with my groups redirect link. It was working but now directs to the standard 404 page not found. I have sent my login details to your support email – hoping you can take a look for me.

    • Thanks Sarah, I’ve checked it and released version 1.2.2 of the Groups 404 Redirect plugin which fixes that. Many thanks for pointing out the issue!

  • Bob Dunn

    I am using the redirect with the groups plugin and WooCommerce. I have it redirecting to a specific page which works great. But the one problem, if you click on “lost password” anywhere, even on the WP login page, it redirects to that page I have set up. It’s not a protected page, so why is it doing this. No one can retireve a lost password. https://bobwp.com/wp-login.php

    • Have you added any access restrictions to the lost password page? Also note that there are two different links to a password recovery page, one of those produces a 404.

  • Robert

    Hi Kento,

    I’ve downloaded the Groups 404 plugin, however, am having issues with it redirecting properly.

    I noticed in a previous post that there was an issue with it and how Genesis handles 404 errors. We use the Genesis framework and I’m also encountering the same issue and am wondering if you have any suggestions on how to handle this?

    • Hi Robert,

      I’ve just tested it and it works fine here on a test installation. I have tested redirection to the home page, to the WordPress login and to a specific page, all work correctly with the Genesis framework and a theme based on it enabled.

      I suppose you have another thing conflicting …

  • Hi there,

    I’m having trouble with the 404 redirect for a restricted page and I can’t get it to work with any of the settings. If you go to my demo environment at http://www.GreenPeakLabs.com/makerplace/members-home (a restricted page) you’ll see that it takes you to a 404 page on my primary domain site (as opposed to a 404 on the demo site when it’s off).

    Any ideas why it may be doing that?

    • antonio

      Hi,
      sorry I don’t know your demo and primary domain. You can send us dashboard admin access to support at itthinx dot com and we’ll have a look (please indicate this comment in the email).
      cheers

  • Tim

    Running into an issue and unable to get this 404 redirect to work. I’ve tried both the redirect to login and the redirect to specific (home) page. Running into a 502 bad gateway error.

Leave a comment

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

*

Please follow the Support guidelines.

Premium Support is available for customers in the Forums.