Category Archives: Web Development

Generating bcrypt .htpasswd passwords using PHP

In my previous post we saw how to generate .htpasswd file using crypt and apr1-md5 algorithm in PHP. However, now there is a more secure BCRYPT algorithm that can be used since apache 2.4 for passwords in .htpasswd. In this post we will generate .htpasswd file using the BCRYPT algorithm in PHP.
Read more »

How to remove render blocking JavaScript with defer and async

With HTML5 there are 2 new boolean attributes for <script> tag which indicates to the browser how the script should be evaluated. The 2 attributes are defer and async. Using these attributes can help improve the page load time by downloading the script in parallel when the page is being parsed and then executing it either immediately or at the end of page parsing.
Read more »

How to sort a multi-dimension array by value in PHP

In this article we will see how to sort a multi-dimension array by value of one of the keys of the array. We can use a few different methods to do this. One way to to use usort() function. Another way is to just identify the values and create another array with the values and then use it in the array_multisort() function. Using the multisort method we can easily sort a multi-dimension array based on its one or more values. Lets see how we can use both these methods.
Read more »

Protocol relative URLs

Many times we have seen warnings similar to “This page contains both secure and nonsecure items” or “This page has insecure content.”. This happens when we are viewing a HTTPS site and some content on the site is loaded from HTTP. So when we try to view a site say https://www.example.com and we get this warning, that means some content on the site is getting loaded from a non https site, like http://www.example.com. These warning messages can be fixed by using protocol relative URLs.
Read more »

Understanding favicon

What is a favicon?

A favicon (short for “favorites icon”) is a small image associated with a website intended to be used when you bookmark a page. Web browsers also use them in the URL bar, on tabs, etc to help the users identify a website. It is typically a 16×16 pixels square icon which is saved as favicon.ico in the root directory of the website’s server.
Read more »