How to Properly Configure Password Protection using IIS Manager

I wrote this article because there seems to be some conflicting information on the Internet, but there is a simple way to password protect a directory in IIS with IIS Manager.

  1. First, connect to your site using IIS Manager.
  2. Next, highlight the root folder or the sub-folder you want to protect and then double click on the Authorization Rules module.

authorizationrules

3. Now, highlight the Allow All Users rule and click on the Remove link.

remove

4. Click on the Add Allow Rule… link which will bring up the window below.

add

5. Select the Specified users: option, enter a Windows/FTP username which has access to the site, and click on the OK button.

Now, when you enter the URL that points to the folder, you will be prompted to enter your Windows credentials to gain access.  If you prefer, you can create a web.config file with the following markup (or add it to an existing one) and place it the directory you want to protect.

< ?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system .webServer>
        <security>
            <authorization>
                <remove users="*" roles="" verbs=""></remove>
                <add accessType="Allow" users="WindowsUsername"></add>
            </authorization>
        </security>
    </system>
</configuration>

Error in URL Rewrite Rules for WordPress 4.6.1 Multi-site Configuration

Yesterday, one of our customers asked for help troubleshooting a 404 error he was getting every time he tried to access the dashboard (admin interface) of any sub-site he created and wondered if there was anything that needed to be changed server side to get it to work.   I informed him that if he followed the instructions on WordPress’ Official Site, it should work without additional intervention from us.  I was partially correct.  Since I’ve never configured a WordPress Multi-site before, I spent more than a couple of hours going through the steps myself and indeed ran into the same problem that our customer experienced.  I then scoured the web for a solution and knew it had something to do with the URL Rewrite rules but was unable to figure out a solution.  Fortunately, our customer was able to find the solution himself which I will now share with you.

On line 24 (WordPress Rule 4) of the web.config markup that WordPress gives you when you click on the Network Setup link under Settings, it reads:

<action type=”Rewrite” url=”{R:1}” />

It needs to be changed to:

<action type=”Rewrite” url=”{R:2}” />

Many thanks to Lucas Nieboer for pointing out the solution!

Installing PEAR 1.1.6 in a Hosting Environment

Contrary to the instructions provided on the official PHP website, there are a few extra steps that you need to make in order to setup PEAR on your hosting provider’s systems if they don’t have it installed already.  First, you’ll need to download the go-pear.php file and then make the following changes to lines 116-119 of the code:

From:

'PEAR5.php' => 'https://raw.github.com/pear/pear-core/master/PEAR5.php',
'PEAR.php' => 'https://raw.github.com/pear/pear-core/master/PEAR.php',
'Archive/Tar.php' => 'https://raw.github.com/pear/Archive_Tar/master/Archive/Tar.php',
'Console/Getopt.php' => 'https://raw.github.com/pear/Console_Getopt/trunk/Console/Getopt.php',

To:

'PEAR5.php' => 'https://raw.githubusercontent.com/pear/pear-core/master/PEAR5.php',
'PEAR.php' => 'https://raw.githubusercontent.com/pear/pear-core/master/PEAR.php',
'Archive/Tar.php' => 'https://raw.githubusercontent.com/pear/Archive_Tar/master/Archive/Tar.php',
'Console/Getopt.php' => 'https://raw.githubusercontent.com/pear/Console_Getopt/master/Console/Getopt.php',

Basically, you need to change github to githubusercontent on all 4 lines and on the fourth line, change trunk to master.  Upload the go-pear.php file to your hosting account and in a browser, execute it by typing in the URL (e.g. http://www.mydomainname.com/go-pear.php).  You should get a screen like the one below.

go-pear-installer

You can safely ignore the ereg() function deprecation error if you get it.  Click on the Next >> link.

configuration

The Installation prefix should be an absolute path to the directory where go-pear.php was uploaded.  You also might need to change line 11 and ask your hosting provider what value to enter because for me, it was not pointing to the correct directory where PHP was installed.  It was pointing to my hosting space which is on another drive.  You can leave the other values at their default settings or modify them accordingly to your needs.  Click on the Install button when you’re ready to begin.

installation

You’ll get an Installation in progress screen, and all you can do is grab a cup of your favorite drink while you wait.  It does take a few minutes.

completed

After waiting a bit, you should get an installation completed screen like the one above.  Pay attention to the Note as you will need to add that to your include_path in either the php.ini or .user.ini file so that your code can find the PEAR files.  If you click on the Start Web Frontend of the PEAR Installer >> link, it probably won’t work.  There is one more step to be performed in order to get PEAR (or at least the management console) working correctly.  There should be a pear.conf file in the directory where you uploaded go-pear.php.  Make a copy of that file and name it pear.ini, or you can just rename it.  I recommend copying it though since that makes the original a backup.  Now, load the index.php file in your browser, and you should get a screen like this.

pearmanager

That’s it.  PEAR is now installed and ready to be used.  If you need to make more configuration changes, please consult the PEAR FAQ and Manual.