Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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]

Thanks.

share|improve this question

migrated from stackoverflow.com Nov 22 '11 at 22:19

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

1  
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

1 Answer 1

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"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <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}}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
share|improve this answer

Your Answer

 
discard

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