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:
- Does the site have an .AU domain name?
- 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.
- Improve the cacheablity of a site’s resources to conform to best practice techniques.
- 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: http://www.example.com/ 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 http://www.example.com and http://example.com/ 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.
RewriteCond % ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$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:
RewriteCond % ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$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 as shown below.
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 provide a series of tips and tricks to help you keeping your site safe from hackers on their official website which is certainly a good first step towards your web server.
- 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.