Search Engine Friendly (SEF) URLs with Joomla

Joomla is a very popular CMS (Content Management System) that supports SE-friendly URLs. It is designed for usage with Apache Web Server, and it has no default solution to use with IIS and ISAPI_Rewrite. But of course you can use this CMS with IIS Web Server, and ISAPI_Rewrite will help you to enable SE-friendly URLs. This short article describes how to setup Joomla to use with ISAPI_Rewrite 3. In this article we suppose you already have IIS and ISAPI_Rewrite 3 installed. To write the article, we used ISAPI_Rewrite 3.1.0.56 and Joomla 1.5.6.

Getting and Installing Joomla

You can download Joomla from official web site: http://joomla.org/download.html. After downloading please install Joomla according to installation instructions provided by vendor.

Enabling SE-friendly URLs

By default SE-friendly URLs are disabled. To enable this feature please go to the administration panel of Joomla. On the main page of administration panel please select “Global Configuration”

Picture 1. Joomla’s administration panel.

On the opened page you can see the group-box called “SEO Settings”. Please select “yes” for options “Search Engine Friendly URLs” and “Use Apache mod_rewrite”. Then apply and save your settings. Also please go to Joomla installation folder and rename htaccess.txt file to .htaccess.

Picture 2. Configuration for SEO-friendly URLs.

Now all URLs on your site are SE-friendly. But there are some hurdles left. When you type different URLs in the address bar you always end up with the main page. It happens because Joomla uses variable $_SERVER[ ‘REQUEST_URI’ ] which is not supported by IIS.

Patching Joomla

You will need to add a little fix in the Joomla’s source code. Please copy this code to clipboard:

if ( isset( $_SERVER[ 'HTTP_X_REWRITE_URL' ] ) ) { $_SERVER[ 'REQUEST_URI' ] = $_SERVER['HTTP_X_REWRITE_URL' ]; }

Now you need to find index.php file in the root of Joomla installation folder. Open this document with any editor supporting Unix format (e.g. WordPad). Note: you can’t use Notepad to edit index.php because Notepad does not support saving in Unix format. Paste code above at the top of index.php as shown on this picture:

Picture 3. Patched index.php.

Done! Now you can use Joomla CMS with pretty SE-friendly URLs. This article describes how to use Joomla with its default rules in .htaccess file but of course you may replace them.

This entry was posted in ISAPI_Rewrite and tagged . Bookmark the permalink.

Comments are closed.