Title: Site Redirection Help
Last modified: August 21, 2016

---

# Site Redirection Help

 *  [sicky_brazz](https://wordpress.org/support/users/sicky_brazz/)
 * (@sicky_brazz)
 * [12 years ago](https://wordpress.org/support/topic/site-redirection-help/)
 * Hi, I am trying to set my site up with a “None registered users are redirected
   to a landing page” scenario.
 * I would like it so that all none registered users are redirected from all my 
   pages (with the exceptions of only my registration, contact us, ToS & PP pages)
   to my landing page, NOT my home or login.php etc.
 * So how can I go about doing this properly?
 * I have tried using the following code but I just get a continuous redirect loop
   on normal WordPress pages and it seems to totally ignore my BBPress and BuddyPress
   pages, having them load no matter if the user is logged in or out.
 * This is the code I was using:
 *     ```
       add_action('init','boot_non_users');
       function boot_non_users() {
         $world_pages = array(106,101,105,102,70,82,50,67,103,104);
   
         if (!in_array(get_the_ID(),$world_pages))
            if (!is_user_logged_in())
               wp_redirect('http://www.carfreaksunite.com/cfu-login');
       }
       ```
   
 * P.S.
    I’m no coder and the above code was provided to me, so if anyone could 
   provide help or guide me in the right direction of help (remembering I’m a noob
   at this), that would be awesome.
 * Cheers.

Viewing 1 replies (of 1 total)

 *  Thread Starter [sicky_brazz](https://wordpress.org/support/users/sicky_brazz/)
 * (@sicky_brazz)
 * [12 years ago](https://wordpress.org/support/topic/site-redirection-help/#post-4904044)
 * ***UPDATE***
    I still need a hand but not as much as before…
 * I have now put the following code into my functions.php file which allows me 
   to essentially have 2 home pages, 1 for logged in users, 1 for logged out users.
   
   This is the code:
 *     ```
       /********** Multiple Static Home Pages **********/
       if( is_user_logged_in() ) {
           $page = get_page_by_title( 'Welcome!');
           update_option( 'page_on_front', $page->ID );
           update_option( 'show_on_front', 'page' );
       }
       else {
           $page = get_page_by_title( 'CarFreaksUnite' );
           update_option( 'page_on_front', $page->ID );
           update_option( 'show_on_front', 'page' );
       }
       ```
   
 * However, I still can not get my head around, and could do with a solution to:
   
   >> Why I cant redirect my logged out users to my (now) home page without getting
   a continuous redirecting loop. >> Why BBPress and BuddyPress just wont follow
   any redirects.

Viewing 1 replies (of 1 total)

The topic ‘Site Redirection Help’ is closed to new replies.

## Tags

 * [redirect](https://wordpress.org/support/topic-tag/redirect/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [sicky_brazz](https://wordpress.org/support/users/sicky_brazz/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/site-redirection-help/#post-4904044)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
