A few quick tips on how to improve site speed

Search engines care about page speed. Users care about page speed. It only makes sense that you try to make your pages load as quickly as possible, without losing anything important.

So, here's a few quick tips on how to do that. Let's get into it:

1. Reduce number of HTTP requests

Browsers have limitations how many parallel requests per server/proxy they do.

Firefox 2:  2
Firefox 3+: 6
Opera 9.26: 4
Opera 12:   6
Safari 3:   4
Safari 5:   6
IE 7:       2
IE 8:       6
IE 10:      8
Chrome:     6

Source: stackoverflow, you can also take a look at Browserscope.

So, what can we do about this? First thing that comes to mind is bundling. Bundling basically means that you combine all the different CSS or JS files into a single file which then browser downloads using only one HTTP request.

Before bundle:

After bundle:

Pretty nice, huh? In this manner we can really reduce the number of HTTP requests. So how do we do bundling?

Another way to reduce number of HTTP requests is also to use CSS sprites. This means combining image parts of your layout into one large image and then use CSS background-position to show appropriate part. This way not many small images are downloaded, but one larger which again - reduces the number of HTTP requests.

Not really related to bundling or sprites, but I also found one extra tip for designers - this interesting point on Dawid Walsh's blog - Combine Your CSS Media Styles Into One File.

More...

Return HTTP status code 404 and error content in ASP.NET MVC

Google and all other search engines say "don't do soft 404". The proper way to return a 404 is with a 404 status code and some content that indicates that the requested page is not available. But the key thing is to return Real 404 HTTP status code and avoid any solution that replaces 404 with 301. This is completely wrong and has a potential to do damage to your site.

How to do this? Well, as always in IT there are different ways. Here's how I usually do it.

Add this to web.config:

<system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404" />
      <error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
    </httpErrors>
  </system.webServer>

More...

Direct social sharing URLs

There are cases when you don't want to add some plugin to your blog or to the website you're building simply to have social sharing links on your site.

You might also want to be in full control of your design.

In cases like these it's hand to have a set of commonly used social links.

So, here hey are.

Facebook

https://www.facebook.com/sharer/sharer.php?u={siteUrl}

More...

Handler PHP_via_FastCGI has a bad module FastCgiModule in its module list

I have seen that a lot of people visit this site when searching for:

Handler "PHP_via_FastCGI1" has a bad module "FastCgiModule" in its module list.

So, here's how to solve this:

  1. Go to Control Panel -> Programs and Features -> Turn Windows features on or off
  2. Scroll to Internet Information Services -> World Wide Web Services -> Application Development Features
  3. Turn on CGI
  4. Wait a bit
  5. Enjoy

For more information how to configure PHP on IIS visit Installation on Windows systems on php.net.

Getting started with Virtualization - Create a Ubuntu Virtual Machine

This will be brief but (excuse me for saying so myself) a cool little blog post about getting started with virtualization. We'll get into an example right away and some minutes from now you'll be testing your website in real IE6 on a virtual machine. Don't care about IE6? Fine, later in the article we'll quickly create our own little machine where you can install any software you might find useful.

We'll install Ubuntu. Why? Because it's free and cool.

More...