Title: [Plugin: Protected Site] Double folder name
Last modified: August 20, 2016

---

# [Plugin: Protected Site] Double folder name

 *  [valcorin](https://wordpress.org/support/users/valcorin/)
 * (@valcorin)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-protected-site-double-folder-name/)
 * With my blog setup as
 * [http://hostname/blogname](http://hostname/blogname)
 * the redirect was calculating the URL as
 * [http://hostname/blogname/blogname/index.php](http://hostname/blogname/blogname/index.php)
 * I had to change the php code to the following for it to work at my site:
 * `$path = parse_url(get_bloginfo('url'),PHP_URL_SCHEME) . '://' . parse_url(get_bloginfo('
   url'),PHP_URL_HOST).$_SERVER['PHP_SELF'];`
 * that line is located here:
 *     ```
       <p><strong>Sorry!</strong> You must <a href="<?php bloginfo('url'); ?>/wp-login.php?redirect_to=<?php
       			$path = parse_url(get_bloginfo('url'),PHP_URL_SCHEME) . '://'.parse_url(get_bloginfo('url'),PHP_URL_HOST) . $_SERVER['PHP_SELF'];
       			echo $path;
       		?>&reauth=1">log in</a> to view this page.</p>
       ```
   
 * [http://wordpress.org/extend/plugins/protected-site/](http://wordpress.org/extend/plugins/protected-site/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [valcorin](https://wordpress.org/support/users/valcorin/)
 * (@valcorin)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-protected-site-double-folder-name/#post-3024414)
 * For those who just want all users who aren’t logged in directed to the login 
   page, you can modify the plug-in to the following:
 *     ```
       <?php
       /*
       Plugin Name: Protected Site
       Description: Block users from accessing your blog or a specific blog in your network by activating this plugin on the blog you wish to protect.
       Author: Davo Hynds
       Version: 1.0
       Author URI: http://ashramcreative.com
       Modification: Code modified to redirect to the login page rather than requiring a click through
       */
   
       add_action( 'get_header', 'ac_protected_site' );
       function ac_protected_site() {
       	if ( !is_user_logged_in() ) {
       		$bigurl = home_url().'/wp-login.php?redirect_to=';
       		$path = parse_url(get_bloginfo('url'),PHP_URL_SCHEME).'://'.parse_url(get_bloginfo('url'),PHP_URL_HOST).$_SERVER['PHP_SELF'];
       		$bigurl = $bigurl.$path;
       		header( "Location: $bigurl" );
       	}
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Protected Site] Double folder name’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/protected-site.svg)
 * [Protected Site](https://wordpress.org/plugins/protected-site/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/protected-site/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/protected-site/)
 * [Active Topics](https://wordpress.org/support/plugin/protected-site/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/protected-site/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/protected-site/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [valcorin](https://wordpress.org/support/users/valcorin/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-protected-site-double-folder-name/#post-3024414)
 * Status: not resolved