Rewrites in included text files are not working

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 05 Mar 2014, 09:11

Rewrites in included text files are not working

05 Mar 2014, 09:19

I have 3 areas in one site hosted on IIS6

each area is its own site with its own .htaccessfile and 5-10 additional .txt files which we store translations from page friendly URLs into IDs used with in our system

All the links in the htaccess and .txt files work in 2 sites but one of them doesn't seem to be using the txt files to produce the correct url resulting in 404 errors

I checked the log files and all txt files and httacces files are being successfully loaded and the scripts that the rewrite points to exist and the permissions on the folders are suitable to load the scripts.

Unfortunatly it would appear that the log files don't record how the re-writes are calculated making it impossible to know weather or not the text files are being correctly interpreted.

the rewrite engine is on.

An example of the re-write rule that doesn't work below

.htaccess file rule

RewriteMap itemgallerycategories.txt txt:includes/isapi/itemgallerycategories.txt
RewriteRule ^/UtilevMarketingToolkit/Image-Library/Available-Images/_cat_([^?/]+)\.htm(?:\?(.*))?$ /UtilevMarketingToolkit/gallery/bycategory.asp?pid=56&iid=${itemgallerycategories.txt:$1}&$2

the data in the itemgallerycategories.txt

advertising_1 1
brand-assets_2 2
stationary_4 4
brochures_5 5
spec-sheets_6 6
display-pos_7 7
vehicle-and-building-signage_10 10

the path to the text file is correct but I am unable to get any information out of Isapi 3 to suggest any error

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

Re: Rewrites in included text files are not working

05 Mar 2014, 10:48

Hello,

Let me try to help you with this...

1. I'm not sure what you meant by:
Unfortunatly it would appear that the log files don't record how the re-writes are calculated making it impossible to know weather or not the text files are being correctly interpreted.

But the log we're interested in is rewrite.log, not error.log. See FAQ (http://www.helicontech.com/forum/10648-FAQ.html) to see how to enable it.

2. You're trying to match a query string with an incorrect syntax. See FAQ under "Initial query string is appended to rewritten url"(if your querystring is not appended successfully, try using QSA-flag) AND "URLs with question mark don't work".

3. Also, in .htaccess file "RewriteBase /" is enabled by default, so the rule should start as:
Code: Select all
RewriteRule ^UtilevMarketingTo


4. To use all the above and make your life easier debugging, try to change (temporary) the rule type to R=301, so that it'd change the URL in a browser and let you see what you're getting.

User avatar
Posts: 2
Joined: 05 Mar 2014, 09:11

Re: Rewrites in included text files are not working

05 Mar 2014, 11:32

Thanks for the quick response.

I have implemented your suggestions and they appear to have gotten this working, I couldn't swear to which step or if they all helped but thanks for the assist.

My comment was actually about the re-write log, I have used similar products before and they display how a rule was interpreted the re-write log shows which rule is hit however in this instance I needed to know how the URL was transformed to get the page friendly name from the posted query string.

I really appreciate your assistance

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests