URL Rewrite Problem

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 8
Joined: 18 Dec 2012, 11:49

URL Rewrite Problem

17 Sep 2014, 13:25

I'm wanting to be able to have url's like this

http://examplesite.com/12345
http://examplesite.com/page/12345
http://examplesite.com/notes/12345

Below is what I'm using and the second 2 are working but if you try going to the http://examplesite.com/12345 NOTHING... Any suggestions?
#Remove Trailing Slashes
RewriteRule (.*)/$ $1 [NC,R=301,L]

RewriteRule ^/(.*)$ /somepage.aspx?var=$1 [NC,L]
RewriteRule ^/(.*)$ /$1 [NC,L,R=301]

RewriteRule ^/page/(.*)$ /somepage.aspx?var=$1 [NC,L]
RewriteRule ^/page/(.*)$ /app/$1 [NC,L,R=301]

RewriteRule ^/notes/(.*)$ /somepage.aspx?var=$1 [NC,L]
RewriteRule ^/notes/(.*)$ /desktop/$1 [NC,L,R=301]

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

Re: URL Rewrite Problem

17 Sep 2014, 15:22

Hello,

I believe I understand. The easiest fix for you will be to change the order of the rule. Since ISAPI_Rewrite is serving requests by 'first-matched-first-redirected' kind of principle, I'd suggest you simple put the more generic patters on the bottom and less generic on top. Currently (.+) will match your '/page/1234 requests and they wouldn't even make it to the second rule.

Regards

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 4 guests