Help with this rewrite rule

Jul 2, 2010 at 11:22 AM
Edited Jul 2, 2010 at 11:27 AM

Hi,

 

Recently i have installed iirf in my local and want to test it. I think i am writing the rules wrong

 

Please give me a rule which could do the following

http://localhost/mysite/default.asp?id=4 or http://localhost/mysite/default.asp?id=4 to http://localhost/mysite/4 or http://localhost/mysite/somename

also another rule

http://localhost/mysite/default.asp?id=127&Month=1&Year=2009  to  http://localhost/mysite/127(somename)/Month/1/Year/2009

Please help. My iis is 5.1 and i know that iirf is functioning from iirfstatus.

If it works well i have to implement this in live

 

also please give me a simple redirect rule to test whether my iirf is working or not like

when i go to http://localhost/mysite/default.asp?id=4 it should redirect me to http://www.codeplex.com

 

Jul 2, 2010 at 8:05 PM

Try:

RewriteRule ^/mysite/default.asp?id=([0-9]*)$ /mysite/default/$1

or

RewriteRule ^/mysite/default.asp?id=([^/]*)$ /mysite/default/$1

 

Jul 5, 2010 at 5:49 AM
Edited Jul 6, 2010 at 7:48 AM

Thanks sir ,

 

When i use the abone rule it works when i manually type the url as

http://localhost/mysite/2  leadsme to http://localhost/mysite/default.asp?id=2

but when i click on a menubar the url is not appending and it shows the old url like

http://localhost/mysite/default.asp?id=2

 

I have also used the following to test and append but it is going to infinite loop

RedirectRule ^/mysite/default\.asp\?id=1$  /mysite/Home [R=301]

RewriteRule ^/mysite/Home$  /mysite/default.asp?id=1 

 

I dont know what wrong i did. Please Help me..

Jul 6, 2010 at 6:54 PM

Sounds like IIRF is installed correctly and the rules are working just fine. Check your <a href> tags to make sure they are using the new and improved url: http://localhost/mysite/default/2 or whatever

Jul 9, 2010 at 7:56 AM
Edited Jul 9, 2010 at 12:09 PM

thanks freeride,

 

The issue is solved by using the [L] flag for stopping it to move recursively.

Modified rules were

RedirectRule ^/mysite/default\.asp\?id=1$  /mysite/Home.html 

RewriteRule ^/mysite/Home.html$  /mysite/default.asp?id=1 [L]

 

Actually i cant  change the old urls because all urls are made dynamically according to the conditions.