Password Protect WordPress Admin With .htaccess

The wp-admin panel is already password protected in that you are required to login. Sometimes that’s not good enough. This tutorial explains how to add an additional layer of authentication to the login process, essentially blocking wp-login.php requests from annoying bots or other malicious users.

Step 1:

Create a `/path/to/.htpasswd` file. (More info.)

Step 2:

Create a `/path/to/your/site/wp-admin/.htacess` file with the following content:

AuthUserFile /path/to/.htpasswd
AuthType basic
AuthName "Restricted Resource"
require valid-user

# Whitelists

<Files "admin-ajax.php" >
   Order allow,deny
   Allow from all
   Satisfy any
</Files>

<Files "*.css" >
   Order allow,deny
   Allow from all
   Satisfy any
</Files>

<Files ~ "\.(jpg|jpeg|png|gif)$">
   Order deny,allow
   Allow from all
   Satisfy any
</Files>

Change `/path/to/` your files accordingly.

Important! Under Whitelists I have added entries for admin-ajax.php, *.css, and a regular expression for images. This unblocks WordPress’ AJAX functionality used by certain plugins, as well as CSS and image files certain themes may be importing. Without these you risk breaking your site.

Step 3:

Append the following to your existing WordPress .htaccess file one parent folder up (Ie. /path/to/your/site/.htaccess):

<Files wp-login.php>
  AuthUserFile /path/to/.htpasswd
  AuthType basic
  AuthName "Restricted Resource"
  require valid-user
</Files>

Change `/path/to/` your files accordingly.

Fail Fast

My wife, my daughter, and I moved to Japan end of last year.

KIZU514, or me as a freelancer, was based on the idea that my wife would support our family in Japan while I would be some sort of bonus income.

We sacrificed a lot to get here but unfortunately Japan isn’t working out. We are disappointed but all things considered our adventure must end prematurely.

Moving forward I’m trying to find our way back to Montreal. That plan involves me looking for a job with health insurance.

I will keep running KIZU514 as a professional blog.

Waiting room
I am a patient boy…

The Code Manifesto

We want to work in an ecosystem that empowers developers to reach their potential–one that encourages growth and effective collaboration. A space that is safe for all.

A space such as this benefits everyone that participates in it. It encourages new developers to enter our field. It is through discussion and collaboration that we grow, and through growth that we improve.

In the effort to create such a place, we hold to these values:

  1. Discrimination limits us. This includes discrimination on the basis of race, gender, sexual orientation, gender identity, age, nationality, technology and any other arbitrary exclusion of a group of people.
  2. Boundaries honor us. Your comfort levels are not everyone’s comfort levels. Remember that, and if brought to your attention, heed it.
  3. We are our biggest assets. None of us were born masters of our trade. Each of us has been helped along the way. Return that favor, when and where you can.
  4. We are resources for the future. As an extension of #3, share what you know. Make yourself a resource to help those that come after you.
  5. Respect defines us. Treat others as you wish to be treated. Make your discussions, criticisms and debates from a position of respectfulness. Ask yourself, is it true? Is it necessary? Is it constructive? Anything less is unacceptable.
  6. Reactions require grace. Angry responses are valid, but abusive language and vindictive actions are toxic. When something happens that offends you, handle it assertively, but be respectful. Escalate reasonably, and try to allow the offender an opportunity to explain themselves, and possibly correct the issue.
  7. Opinions are just that: opinions. Each and every one of us, due to our background and upbringing, have varying opinions. The fact of the matter, is that is perfectly acceptable. Remember this: if you respect your own opinions, you should respect the opinions of others.
  8. To err is human. You might not intend it, but mistakes do happen and contribute to build experience. Tolerate honest mistakes, and don’t hesitate to apologize if you make one yourself.

Source

PHP Code Of Conduct, Discussion

« I note that after much hue and cry, and many arguments, I still do not know what color this bikeshed will be.

I feel I have been informed of the many examples of problems with colors, cultural relevance of specific hues, details of paint techniques, anecdotes of past experiences with varying colors, larger socio-economic issues reflected through color choices, philosophy of colors, philosophy *about* the philosophy of color, legal and moral issues confronted during color evaluation, the impact of other bikeshed color choices, and how specific colors (and patterns) are under-represented, the finer details of paint application personel selection, and how certain colors are representative of larger social issues being played out in microcosms in individual environments…

….but I still do not know what color this bikeshed will be.

Please advise. »

Source.