IIS 7 - Rewrite rules being read, but not applied in .htacce

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 23 Jul 2012, 10:12

IIS 7 - Rewrite rules being read, but not applied in .htacce

23 Jul 2012, 10:19

I'm running IIS 7 with a fully registered, paid for ISAPI rewrite.
If I put my rules into the global httpd.conf they are logged and applied fine. I see the test against each rule and see the log telling me the rewrite has occurred.
If I copy those same rules to a .htaccess file, and remove them from the httpd.conf, then restart IIS I see the tests against each of them, but they each seem to fail (Or at least the rewrite never occurs).

Anyone know what I could be doing wrong? I'm modifying a site created by another person, and the site has multiple .htaccess files in different folders, with independent rules, so without doing a lot of faffing, I couldn't just merge them all into the httpd.conf and so I need to get this working. Incidentally it works on the live server fine, using the same licence details, and same configuration (afaik).

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: IIS 7 - Rewrite rules being read, but not applied in .ht

23 Jul 2012, 10:31

Please, provide an example of that log for testing request and .htaccess file.

Regards
Andrew

User avatar
Posts: 2
Joined: 23 Jul 2012, 10:12

Re: IIS 7 - Rewrite rules being read, but not applied in .ht

26 Jul 2012, 04:45

I've zipped up the .htaccess file with the rules in - the httpd.conf files with the same rules in and the logs from each attempt. When the .htaccess file was being used the log is considerably smaller as none of the rules seem to match. Unlike the httpd.conf, where the rules match and thus the log is much longer.
Attachments
www-dev.zip
(5.33 KiB) Downloaded 1050 times

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: IIS 7 - Rewrite rules being read, but not applied in .ht

26 Jul 2012, 06:26

Peace of cake!

Take a look:

Log for httpd.conf
Code: Select all
3) applying pattern '^/([-_a-zA-Z0-9]+)/wrong-password/?$' to uri '/fos-test'

Log for .htaccess
Code: Select all
3) applying pattern '^/([-_a-zA-Z0-9]+)/wrong-password/?$' to uri 'fos-test'


the difference is in '/' in front of the incoming request. The reason for this is that in .htaccess file the 'RewriteBase /' is already enabled.
All you need to do is to remove the '/' from the beginning of the pattern.

Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 7 guests