Archive for the ‘Web Development’ Category

WordPress: Restricting website access to your IP address

For various reasons, you might need to restrict your website to your IP address.
This is particularly useful for development purposes, as it blocks access to the website (or to redirect the visitor somewhere else), while allowing the developer to navigate through it normally.

In order to only allow your IP address to access your website (or blog) and block everyone else from accessing it, just add these 3 lines to your .htaccess file:

order deny,allow
allow from
deny from all

Simply replace “” with your own IP address, save your .htaccess file and test it out!
If you can’t find your IP address, simply use or any similar site to obtain it (there are plenty of them).

A very efficient way to test if someone is able to access your website through a different IP address is by using a web proxy to access it (such as MegaProxy for example).
To revert the changes and therefore allow everyone to access the website again, simply delete those lines from .htaccess and save the file again.

Adobe CS5: Payload cannot be installed due to dependent operation failure

I just got this error while trying to install a few applications from the Adobe CS5 suite on a relative’s system today.

The installation would basically stop, and the following would show up in the installation logs:

WARNING: Payload cannot be installed due to dependent operation failure

After some research with no productive results I had to investigate this myself and after about 30 minutes I was able to pinpoint the cause by mere chance (or should I say, experience?); mostly due to past problems with Adobe products (Adobe Reader), as even though the error wasn’t the same — the solution was.

I tend to customize every OS I install, not only to suit my needs but also to calm down my data-loss and “what if he/she breaks the system afterwards” paranoia, so one of the very first things I do on my friends/relatives’ systems is to modify their “user folders”, mainly to ensure they won’t lose any data if they ever break Windows to a point where a fresh install is required.

Usually I create a partition within the same physical disk, assign a drive letter (usually D) and label (Data).
Most Windows users aren’t that technical, and despite having such partition available, they will still save everything under “My Documents”, so I had to figure out a way to force them to save the data into the designated folders. The solution was to map their folders to the D drive, so when they save their data to “My Documents” or any other user folder, they’re actually saving the data to the secondary partition that I have just created.

Everything usually works fine but for some reason that I cannot understand (I can but I cannot believe Adobe didn’t think about this), most of the Adobe products I install have a problem with this setup (even though Windows allows you to do this by default, it’s a feature).

The solution is quite simple, you either have to recreate the user folders in their default location (C:\Users\USERNAME), or to simply temporarily undo your home folder path customization, installing your Adobe applications and then redo your customization all over again.

If you opt for the first option, here is the list of folders that you’ll have to create/recreate in order to prevent Adobe’s setup from failing (due to a non-existing path):

  • C:\Users\USERNAME\Contacts
  • C:\Users\USERNAME\Documents
  • C:\Users\USERNAME\Music
  • C:\Users\USERNAME\Pictures
  • C:\Users\USERNAME\Videos

As for the rest of the user folders (Favourites, Saved Games, etc), they aren’t needed as the Adobe Setup won’ t try to access them.
Needless to say, replace USERNAME with your actual username. Then, reboot your system.

That should be it. Once those paths are accessible, the setup should complete without any problem.
If for any reason you’re still getting the same error after this, that probably means the issue isn’t the same so you’ll have to keep investigating it.

If  that’s your case, I strongly recommend you to try Adobe’ s Cleaner Tool  (especially when nothing else works):

Good Luck!

WordPress: Password-Protected pages not working on folders within WordPress’ directory (Error 404)

Symptoms: You add password-protected directories to folders within your WordPress installation, but instead of showing a password-protection prompt, your browser will show a 404 page instead

This appears to be a common issue for users that try to password-protect folders within an installation of WordPress.
This happens because you did not define a 401/403 (depending on the situation) error page in your main .htaccess file.

In order to correct this, you will need to add the 401 error page to your WordPress’ .htaccess file.
Example of a WordPress .htaccess file:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

In order to correct this issue, simply create a 401 and 403 error page (on this example I’m using errors/401.html) and add it to .htaccess:

ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

And that’s it, save .htaccess and your password-protected folders should work now.