web-configurl-rewrite-moduleisapi-rewrite

rewrite rule .htaccess to web.config


Currently I'm running site on simple linux hosting but I bought windows VPS where I installed 2008 server + plesk and I'm trying to move the site on new VPS. I occured a problem - The first index.php page looks fine but it's just LOG-IN page so I have to input login/password credentials and after successfull login I should be in the administrator panel but there is an error:

"500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
"

I think that I have to convert my .httaccess file to web.config which I did but still I'm receiving that error. I dont know whether I did it wrong or I have to do something else.

Here is .httaccess

<IfModule mod_rewrite.c>
RewriteEngine On

#RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

RewriteCond %{REQUEST_FILENAME} !-f

#module@account
RewriteRule ^login.html$                                        /index.php?m=login                                  [L]
RewriteRule ^wyloguj.html$                                      /index.php?m=login&a=wyloguj                        [L]
#RewriteRule ^nowehaslo,(.*).html$                              /index.php?m=login&a=nowehaslo&token=$1             [L]

#module@panel,ajax
RewriteRule ^panel.html$                                        /index.php?m=panel                                  [L]
RewriteRule ^panel,ajax.html$                                   /index.php?m=panel&a=ajax                           [L]
RewriteRule ^produkt/([0-9]*)/(.*)$                             /index.php?m=panel&a=produktplik&user=$1&file=$2    [L]
RewriteRule ^faktura/(.*).pdf$                                  /index.php?m=panel&a=faktura&crypt=$1               [L]
RewriteRule ^productcount,([a-z]*),([0-9]*),([0-9]*).(.*)$      /index.php?m=panel&a=productcount&type=$1&user=$2&product=$3    [L]
RewriteRule ^sprawdz.html$                                      /index.php?m=panel&a=sprawdz                        [L]

#module@claim
RewriteRule ^reklamacja,(.*).html$                              /index.php?m=claim&ident=$1                         [L]

#module@cron
RewriteRule ^cron,([a-zA-Z0-9_]*).html$                         /index.php?m=cron&f=$1                              [L]
RewriteRule ^userCron,(.*),(.*).html$                           /index.php?m=cron&a=userCron&f=$1&user=$2           [L]

And here web.config

<?xmlversion="1.0"encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
		
<rulename="rule1e"stopProcessing="true">
	<matchurl="^login.html$"/>
	<actiontype="Rewrite"url="//index.php?m=login"/>
</rule>

<rulename="rule2e"stopProcessing="true">
	<matchurl="^wyloguj.html$"/>
	<actiontype="Rewrite"url="//index.php?m=login&amp;a=wyloguj"/>
</rule>

<rulename="rule3e"stopProcessing="true">
	<matchurl="^panel.html$"/>
	<actiontype="Rewrite"url="//index.php?m=panel"/>
</rule>

<rulename="rule4e"stopProcessing="true">
	<matchurl="^panel,ajax.html$"/>
	<actiontype="Rewrite"url="//index.php?m=panel&amp;a=ajax"/>
</rule>

<rulename="rule5e"stopProcessing="true">
	<matchurl="^produkt/([0-9]*)/(.*)$"/>
	<actiontype="Rewrite"url="//index.php?m=panel&amp;a=produktplik&amp;user={R:1}&amp;file={R:2}"/>
</rule>

<rulename="rule6e"stopProcessing="true">
	<matchurl="^faktura/(.*).pdf$"/>
	<actiontype="Rewrite"url="//index.php?m=panel&amp;a=faktura&amp;crypt={R:1}"/>
</rule>

<rulename="rule7e"stopProcessing="true">
	<matchurl="^productcount,([a-z]*),([0-9]*),([0-9]*).(.*)$"/>
	<actiontype="Rewrite"url="//index.php?m=panel&amp;a=productcount&amp;type={R:1}&amp;user={R:2}&amp;product={R:3}"/>
</rule>

<rulename="rule8e"stopProcessing="true">
	<matchurl="^sprawdz.html$"/>
	<actiontype="Rewrite"url="//index.php?m=panel&amp;a=sprawdz"/>
</rule>

<rulename="rule9e"stopProcessing="true">
	<matchurl="^reklamacja,(.*).html$"/>
	<actiontype="Rewrite"url="//index.php?m=claim&amp;ident={R:1}"/>
</rule>

<rulename="rule10e"stopProcessing="true">
	<matchurl="^cron,([a-zA-Z0-9_]*).html$"/>
	<actiontype="Rewrite"url="//index.php?m=cron&amp;f={R:1}"/>
</rule>

<rulename="rule11e"stopProcessing="true">
	<matchurl="^userCron,(.*),(.*).html$"/>
	<actiontype="Rewrite"url="//index.php?m=cron&amp;a=userCron&amp;f={R:1}&amp;user={R:2}"/>
</rule>

</rules>
</rewrite>
</system.webServer>
</configuration>

Does anyone can help me with that?

Cheers


Solution

  • It is highly unlikely that a RewriteRule results in 500 error. So, first, I suggest you try try request the destination directly, bypassing the rule to see if it works this way. You can also enable logging in ISAPI_Rewrite to see if the problem happens due to rewriting. And finally, you can use Failed request tracing tool in IIS to see everything that happens to the request, see on which stage it fails and "who" is responsible for this stage.