Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Yesterday, I asked for help on urlrewrite - Ulrich Palha helped me to solve the problem.

His solution is working great on Linux server using .htaccess, and I appreciate his help, but the solution isn't working on a Windows server running IIS. I spent all day trying my best to make it work on a Windows server, but it was a bad day for me :-(, so I'm asking for help.

Here is code that works on Linux using .htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)\.html$ category.php?maincat_url=$1&first_subcat_url=$2&second_subcat_url=$3 [L]


share|improve this question

migrated from Nov 22 '11 at 22:19

This question came from our site for professional and enthusiast programmers.

What are you using on "Windows Server"? Apache? IIS? – vcsjones Nov 22 '11 at 13:38
sorry I forgot to told its IIS – prototype Nov 22 '11 at 13:49
check this: link – rankep Nov 22 '11 at 14:43

You need to install the free URL Rewrite module from Microsoft. Then you should add the following rewrite rule to the your web.config file:

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="Test" stopProcessing="true">
                    <match url="^([^/]*)/?([^/]*)/?([^/]*)\.html$" />
                    <action type="Rewrite" url="category.php?maincat_url={UrlEncode:{R:1}}&amp;first_subcat_url={UrlEncode:{R:2}}&amp;second_subcat_url={UrlEncode:{R:3}}" />
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.