Maprule Overwriting "index.html"

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 20 May 2012, 12:09

Maprule Overwriting "index.html"

20 May 2012, 12:17

Hello, I was able to get ISAPI Rewrite working for my "browse.aspx" page. It accepts the "ID" param and allows me to search for records as their own directory name like "www.mydomain.com/customname"

Here is the code that I'm using:
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteRule ^([^\.\?]+)/?(\?.*)?$ /browse.aspx?team=${mapfile:$1}


But the problem is when I try to load my mobile domain such as "www.mydomain.com/m" it also bounces back to my "browse.aspx" page. It appears that the code I'm using is overwriting my default documents. Could someone please help me determine how not overwrite default documents in other directories as I just want to run the "browse.aspx" page?

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

Re: Maprule Overwriting "index.html"

21 May 2012, 07:28

Hello,

You'll need to exclude certain pages using either separate rule or additional condition as in following:

please, make sure the following rule is the first in your config file
Code: Select all
# this checks for a default page and rewrites it for itself.
RewriteCond %{REQUEST_URI} ^/(?:m|index.asp|otherPageName|etc).* [NC]$
RewriteRule .* - [NC,L]


OR add a condition to an existing rule

Code: Select all
# this checks if it's NOT a default page
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{REQUEST_URI} !^/(?:m|index.asp|otherPageName|etc).* [NC]
RewriteRule ^([^\.\?]+)/?(\?.*)?$ /browse.aspx?team=${mapfile:$1}


Regards
Andrew

User avatar
Posts: 2
Joined: 20 May 2012, 12:09

Re: Maprule Overwriting "index.html"

21 May 2012, 17:20

Ok great! I didn't have the RewriteCond added. Thanks for your help!!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 4 guests