Ian Hoar – Passion for Technology – Geeking Out - Technology, Web, Toys, Games, Design, Entertainment, Gadgets, & Geeking Out

Migrating from IIS to Apache and dealing with broken links and images

Apache ServerI recently had to migrate a large group of microsites from an IIS setup to a new LAMP stack and it proved to be more challenging than I thought. Linux is case sensitive and Windows is not, in other words a file may have been named EN_logo.gif but it may have been embedded with en_logo.gif. This also means any external links coming in with the wrong case would also be broken. A nightmare was in the making, luckily there is a simple Apache module that will fix this.

The first thing you will want to do is make sure the Apache Module mod_speling is enabled. You can enable this in a few ways and it may vary depending on your setup. On Debian and Ubuntu it’s pretty straight forward using the following commands.

cd /etc/apache2/mods-enabled

Type a2enmod to enable an apache module, you will be presented with a list of modules and a prompt asking you which ones you want to enable. Type the name of the module, in this case speling:


This command creates a symbolic link to /mods-available/speling.load

You can now restart apache with:

service apache2 restart

Now you will need to go to the site directory you want to enable mod_speling on and add these two lines to the .htaccess file.

CheckSpelling on
CheckCaseOnly on

The first option enables check spelling which makes Apache attempt to find the page of a mistyped or linked URL. If you don’t want this behaviour in it’s entirety, the second line makes it so it will only check for case matches. This means, FILE.php and file.php will resolve to the same file if only one exists. The system is still case sensitive, but Apache will assume you mean file.php if that is how the file is named.

Other ways to load the speling module

You can also use the following line directing Apache to load the speling.so module.

LoadModule speling_module /usr/lib/apache2/modules/mod_speling.so

Comments are closed.