This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions (Forum Locked Forum Locked)
 Helicon Tech : Common Questions
Subject Topic: need to get number part of filename
Author
Message |
TFR1
Newbie


Joined: 05 November 2009
Location: India
Posts: 7
Posted: 05 November 2009 at 8:44am

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
Posts: 10519
Posted: 06 November 2009 at 2:38am

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
Posts: 7
Posted: 08 November 2009 at 11:34pm

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
Posts: 10519
Posted: 09 November 2009 at 4:54am

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
Posts: 7
Posted: 09 November 2009 at 6:36am

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
Posts: 10519
Posted: 10 November 2009 at 2:17am

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
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum