Friendly URLs for MODx on IIS using .htaccess
23 Dec 2008
This article describes a detailed, step-by-step guide for enabling Friendly URLs on MODx on IIS web server
This solution requires IIS Mod-Rewrite Pro and IIS 6.0 or later, and it is tested with MODx 0.9.6, PHP 5.2.4, and MySQL 5.0.24.
To enable Friendly URLs on MODx on IIS, follow these steps:
- Install PHP following the vendor's instructions.
- Install MySQL Server following the vendor's instructions.
- Install IIS Mod-Rewrite Pro (download).
- If on production environment, activate IIS Mod-Rewrite using a valid license key. If activation is skipped, IIS Mod-Rewrite will work in test mode and you will need to restart IIS every 30 minutes or 1000 requests, if your testing exceeds these limits.
- Install MODx according to the vendor's instructions.
- Locate the file ht.access in MODx root directory and rename it to .htaccess. Since Windows Explorer will not accept the file name ".htaccess", to rename this file open a command prompt window (cmd.exe), change directory (cd) to MODx root, and run the following command:
rename ht.access .htaccess
- Make sure IIS has sufficient access rights to the file .htaccess. The user group IIS_WPG (if running on IIS 6), or the user group IIS_IUSRS (if running on IIS 7), or the current Application Pool's Identity User must have at least "read" access rights to the ".htaccess" file or to the directory that contains this file.
- Open the .htaccess file with a text editor and uncomment the directive RewriteBase /, so that it looks as follows:
- Log on to MODx as administrator, go to admin panel, and open the Tools > Configuration > Friendly URLs page. Set the field "Use friendly URLs" to "Yes" and save the changes.
After, completing all the steps above, your MODx installation will fully serve Search Engine Friendly URLs, and your website's SEO will be drastically improved.