Click to See Complete Forum and Search --> : .htaccess to web.config conversion question


theflyingminst
01-18-2012, 10:52 PM
Hi, I have the following .htaccess file:


RewriteRule ^album/(.*)\.html$ albums.php?album=$1 [L,NC]
RewriteRule ^album/(.*)/([0-9]*)$ albums.php?album=$1&page=$2 [L,NC]
RewriteRule ^([a-zA-Z0-9]*)/$ lyrics.php?letter=$1 [L,NC]
RewriteRule ^([a-zA-Z0-9]*)/([0-9]*)$ lyrics.php?letter=$1&page=$2 [L,NC]
RewriteRule ^lyrics/([0-9]*)/(.*)\.html$ viewlyrics.php?id=$1&title=$2 [L,NC]
RewriteRule ^singer/(.*)\.html$ singer.php?singer=$1 [L,NC]
RewriteRule ^singer/(.*)/([0-9]*)$ singer.php?singer=$1&page=$2 [L,NC]


I am trying to convert it to a web.config file but I'm getting 500 internal server errors


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="album">
<match url="^album/(.*)\.html$" ignoreCase="true" />
<action type="Rewrite" url="albums.php?album=$1 [L,NC]" />
</rule>
<rule name="albums">
<match url="^album/(.*)/([0-9]*)$" ignoreCase="true" />
<action type="Rewrite" url="albums.php?album=$1&page=$2 [L,NC]" />
</rule>
<rule name="lyrics1">
<match url="^([a-zA-Z0-9]*)/$" ignoreCase="true" />
<action type="Rewrite" url="lyrics.php?letter=$1 [L,NC]" />
</rule>
<rule name="lyrics2">
<match url="^([a-zA-Z0-9]*)/([0-9]*)$" ignoreCase="true" />
<action type="Rewrite" url="lyrics.php?letter=$1&page=$2 [L,NC]" />
</rule>
<rule name="viewlyrics">
<match url="^lyrics/([0-9]*)/(.*)\.html$" ignoreCase="true" />
<action type="Rewrite" url="viewlyrics.php?id=$1&title=$2 [L,NC]" />
</rule>
<rule name="singer1">
<match url="^singer/(.*)\.html$" ignoreCase="true" />
<action type="Rewrite" url="singer.php?singer=$1 [L,NC]" />
</rule>
<rule name="singer2">
<match url="^singer/(.*)/([0-9]*)$" ignoreCase="true" />
<action type="Rewrite" url="singer.php?singer=$1&page=$2 [L,NC]" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


- Thanks in advanced for any help with this.

ssystems
01-19-2012, 09:22 PM
[L,NC] is not something that URL rewrite would be

<rule name="album" stopProcessing="true">
<match url="^album/(.*)\.html$" ignoreCase="true" />
<action type="Rewrite" url="albums.php?album={R:1}" />
</rule>


Also take a note that instead of $1 you'll use {R:1}

theflyingminst
01-20-2012, 05:48 AM
Thanks so much!