URL Rewrite Problem
2 posts
• Page 1 of 1
- mdameron76
-
- Posts: 8
- Joined: 18 Dec 2012, 11:49
URL Rewrite Problem
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]
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]
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: URL Rewrite Problem
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
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
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests