| Author |
|
TFR1 Newbie

Joined: 05 November 2009 Location: India
Online Status: Offline Posts: 7
|
| Posted: 05 November 2009 at 8:44am | IP Logged
|
|
|
Hi,
I have a page with URL like http://xxx.com/folder/test123.asp
I need to use both "test" string and "123" number to pass on to a redirecting URL.
Currently I have manage to redirect to http://xxx.com/folder/default.asp?mode=test123&page=6 by following rewriterule.
RewriteRule ^folder/([^?/]+)\.asp /folder/default.asp?mode=$1&page=6 [L]
Please suggest regular expression to pass test as parameter value for mode and 123 as a parameter value for page.
Thanks in advance 
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 06 November 2009 at 2:38am | IP Logged
|
|
|
Please try to use the following rule:
RewriteRule ^folder/(\w+?)(\d+)\.asp$ /folder/default.asp?mode=$1&page=$2 [NC,L]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
TFR1 Newbie

Joined: 05 November 2009 Location: India
Online Status: Offline Posts: 7
|
| Posted: 08 November 2009 at 11:34pm | IP Logged
|
|
|
Thanks Anton!!!
Thanks for ur quick reply that worked perfectly fine as I expected it to be.... 
Just a one quick question.
How can I write If... Else ... Else IF.... kind of looping with ISAPI_Rewrite.
Let me explain scenario... IF pagename contains "AAA" then redirect (axax.asp) else if pagename contains "bbb" then redirect (someotherpage.asp) else redirect(somedefault.asp)
I think this can easily done by RewriteMap. Can you pls focus on this....?
Thanks in advance 
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 09 November 2009 at 4:54am | IP Logged
|
|
|
If I understood you correctly, mapfiles are not necessary. The structure should be as follows:
RewriteRule AAA /axax.asp [NC,R=301,L]
RewriteRule bbb /someotherpage.asp [NC,R=301,L]
RewriteRule .* /somedefault.asp [NC,R=301,L]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
TFR1 Newbie

Joined: 05 November 2009 Location: India
Online Status: Offline Posts: 7
|
| Posted: 09 November 2009 at 6:36am | IP Logged
|
|
|
Humm I got your point.
I forgot to mention that I need to map "AAA" text to something predefined string and so is the case for others...
Thanks for your help...
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 10 November 2009 at 2:17am | IP Logged
|
|
|
So, do you still want to use mapfiles? If yes, the rule will be:
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteRule ^(.+)$ ${mapfile:$1} [NC,R=301,L]
And mapfile should be:
AAA axax.asp
bbb someotherpage.asp
etc.
__________________ Regards,
Anton
|
| Back to Top |
|
| |