Rewrite not woking on IIS7.5

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 5
Joined: 17 Jan 2017, 20:30

Rewrite not woking on IIS7.5

17 Jan 2017, 20:38

I've installed Helicon Ape using MSI installed (for all sites). However rewriter does not seem to work at all.
Any url i try i get 404 error. Rewrite is configured to forbid access to everything (see configs below)
I've tried enabling logging - nothing is logs.
Please help!

Here are the details:
- OS: Windows Server 2008 R2
- Helicon Ape version: 3.1.0.256
- it's registered
- website app domain settings: Integrated mode, .NET 4.0
- https.conf (i've removed most commented out lines):
Code: Select all
# Helicon Ape version 3.1.0.256

Include licenses.conf

Loglevel debug
ErrorLog error.log

Options All -StopOnError

LoadModule rewrite_module       modules/mod_rewrite.so

RewriteLog rewrite.log
RewriteLogLevel 9


- .htaccess in the website director:
Code: Select all
RewriteEngine On
RewriteRule . - [F]
[code]

- web config:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <caching enabled="false" enableKernelCache="false" />
    </system.webServer>
    <system.web>
        <customErrors mode="Off" />
        <compilation debug="true" />
    </system.web>
</configuration>

User avatar
Posts: 5
Joined: 17 Jan 2017, 20:30

Re: Rewrite not woking on IIS7.5

17 Jan 2017, 21:54

Forgot to mention the server is 64 bit

User avatar
Posts: 5
Joined: 17 Jan 2017, 20:30

Re: Rewrite not woking on IIS7.5

18 Jan 2017, 00:14

I got it working after running this command:
Code: Select all
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

User avatar
Posts: 5
Joined: 17 Jan 2017, 20:30

Re: Rewrite not woking on IIS7.5

18 Jan 2017, 00:56

Ok, having other problems.

I had two rules:
Code: Select all
RewriteRule ^/Login\.html$ /login.asp [NC,L]
RewriteRule ^/login\.asp$ /Login.html [NC,R=301]


When i try accessing login.html the rewriter seems to be going into a loop redirecting from login.asp to login.html and back.
This setup used to work on a previous setup (i don't know the version of Ape that was running)

Here are bits from redirect.log:
Code: Select all
40.126.250.71 40.126.250.71  [18/Jan/2017:03:01:37] [x.com/sid#2][rid#19903772/initial] (3) [perdir c:\clc\www\] applying pattern '^/Login\.html$' to uri '/Login.html' -> '/login.asp'
...
40.126.250.71 40.126.250.71  [18/Jan/2017:03:01:09] [x.com/sid#2][rid#49327843/initial/1] (2) [perdir c:\clc\www\] forcing responsecode 301 for http://x.com/Login.html
40.126.250.71 40.126.250.71  [18/Jan/2017:03:01:09] [x.com/sid#2][rid#49327843/initial/1] (3) [perdir c:\clc\www\] applying pattern '^/login\.asp$' to uri '/login.asp' -> 'http://x.com/Login.html'


My live .htaccess file has this:
Code: Select all
RewriteCompatibility2 On
RepeatLimit 200


And these give an error in error.log:
Code: Select all
[2017-01-18 03:52:32.213] [ConfigLoader:2] (error) [/Contact.html] c:\clc\www\.htaccess(7): Invalid command 'RewriteCompatibility2 On' on line 7, perhaps misspelled or defined by a module not included in the server configuration
[2017-01-18 03:52:32.214] [ConfigLoader:2] (error) [/Contact.html] c:\clc\www\.htaccess(8): Invalid command 'RepeatLimit 200' on line 8, perhaps misspelled or defined by a module not included in the server configuration


How can i make the 2 above rules work? I want html files to be rewritten to asp file, but if opening asp files directly i want the user to be redirected to html file. Please help

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: Rewrite not woking on IIS7.5

18 Jan 2017, 08:23

Hello.

Concerning your rewrite rules - change rules order:

RewriteRule ^login\.asp$ /Login.html [NC,NS,R=301]
RewriteRule ^Login\.html$ /login.asp [NC,L]

Next, the "RewriteCompatibility2 On" directive is not supported in Ape. This directive was needed for ISAPI_Rewrite 3 to simplify the transition from ISAPI_Rewrite 2 format rules. ISAPI_Rewrite version 2 has long been discontinued and new products like Ape does not support its rule format.

User avatar
Posts: 5
Joined: 17 Jan 2017, 20:30

Re: Rewrite not woking on IIS7.5

20 Jan 2017, 18:31

This worked. Thanks!

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 40 guests