Four Ways to Optimise Your Apache Web Server for SEO

There are many aspects of SEO such as link building that can take a substantial amount of time before we are able to see a return in the search results. That’s why it is important to have a series of other quick win strategies that start to show results in the mean time.

One of those things that you can do is to optimise your web server for SEO. This is something that very few people either know about or choose which means you can use it to gain an advantage over your competition.

While almost all of the tips outlined below can be adapted to essentially any web server environment (such as IIS for example) I have chosen to focus on Apache, as it is the most common platform available today.

1. Host Locally

Unless your website’s primary audience is a global one, then the physical location of your web server plays an important role in SEO particularly given the rising prominence of local search that we have seen from Google in recent times.

Lets use an example where I perform a search for “”. As at the time of writing there are approximately XXXX results for that particular term. Therefore consider for a moment how a search engine might algorithmically determine what would be the most appropriate examples to return, considering I am performing this search from Australia.

Some of the things search engines are likely to consider are:

  1. Does the site have an .AU domain name?
  2. Does the site mention Australia within their content?

While both of the above factors are indeed strong signals to search engines that the site would be appropriate for an Australian audience there are still other signals that search engines look for.

One of those is where is the site hosted? It is unlikely that a foreign company would choose to host their content on an Australian server; therefore this is a strong indicator that this site is targeted to Australians and would then be an even more relevant result.

2. Install mod_pagespeed

In the past 12 months Google has gone from subtly hinting that they were fans of making the web a faster place, to out and out declaring it as a factor in their search-ranking algorithm.

At first many of the recommendations that Google had made to optimise page load times were not always practical for most developers to implement. Google however recognised this and decided to release an open source Apache module that would automatically do the work for you in the background.

The basic idea behind mod_pagespeed is that it enables a series of optimisation techniques that are based on best practices without you having to make large complex changes to your website.

To demonstrate just how powerful this module is I have provided a quick list of some of the things that previously would have been a nightmare to implement on anything other than a small static site that can now be automated:

  • Provide the server with detailed information about how long each visitor takes to load and render your page.
  • Remove unnecessary whitespace.
  • Combine external and inline CSS/JavaScript files into a single file.
  • Improve the cacheablity of a site’s resources to conform to best practice techniques.
  • Minify and remove comments from all HTML pages, CSS and JavaScript files before serving them to users.
  • Optimise images for performance before serving to users.

You can find further detailed instructions on what exactly mod_pagespeed does and how it does it on the official mod_pagespeed home page.

3. Remove Duplicate Content with mod_rewrite

Unless you have spent some considerable time working in or with people in SEO there is a good chance that you don’t realise that your website might have issues with duplicate content. Allow me to explain:

If you own the website: you are no-doubt aware that you don’t need to type the www in the above URL for the site to load. What however, you may not realise is that to a search engine and are two different sites. So when you have people linking to the non-www version and also the www version you are essentially splitting the value of those links to your website in half.

Luckily there is a solution that is easy to implement. By enabling the mod_rewrite Apache module you are able to tell search engines that any content on the non-www version is now permanently located at the www version. This way not only will search engines not think you have two versions of every page on your site but the value of any links pointing to the wrong version will now flow through the correct page.

To do this, add the following lines to your .htaccess file on your web server. If you don’t already have a .htaccess file you can simply go-ahead and create one.

RewriteEngine On
RewriteBase /
RewriteCond % ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

If however you want to do the reverse and prefer to have the non-www version of your domain as the default you can add the following code instead:

RewriteEngine On
RewriteBase /
RewriteCond % ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

4. Patch Your Web Server

The final point with regards to optimising your web server for SEO is to do with security. For some time now Google has offered notifications for users in the search results that a particular site might contain malware. However, Google recently expanded upon this to now indicate when a site might be hacked or compromised.

The best way to ensure that you do not fall victim to an attack on your website is to keep your web server up to date with the latest software versions and locking down services that you do not need. Apache even provides a series of tips and tricks on their official website to help you keep your site safe from hackers (which is certainly a good first step).


  • Ensure the physical location of your webserver is appropriate for the kind of audience you are trying to target.
  • Optimise the way your web server handles HTTP requests by installing mod_pagespeed.
  • Resolve duplicating your entire website by using mod_rewrite to 301 redirect non-www versions of your URLs to the www version.
  • Ensure your web server environment is kept up to date with the latest security patches to help prevent hackers from attacking your site.

Hopefully, some of the tips I have outlined above will help give you some quick SEO wins and provide you with an edge over your less technically savvy competitors. If anyone has any questions then please just leave them in the comments and I will be sure to respond.

See mhoad's author page for links to connect on social media.

Comments (4)
Filed under: SEO
Still on the hunt for actionable tips and insights? Each of these recent SEO posts is better than the last!

4 Replies to “Four Ways to Optimise Your Apache Web Server for SEO”

Rich Snippets, microformats and RDFa are also very valuable, when it comes to local search…

Hi Joydeep,

Thanks for the comment. That’s actually a good point. One of my collegues here actually touched on that a little while ago here Optimising For Local Search


Thanks a lot for this article I am actually in the process of building a server from scratch. This was a good checklist of some things to keep in mind.

Hey Parzo,

Glad you got something out of the article. Best of luck with the server build.


Your email address will not be published. Required fields are marked *

Serving North America based in the Los Angeles Metropolitan Area
Bruce Clay, Inc. | PO Box 1338 | Moorpark CA, 93020
Voice: 1-805-517-1900 | Toll Free: 1-866-517-1900 | Fax: 1-805-517-1919