This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions
 Helicon Tech : Common Questions
Subject Topic: need to get number part of filename Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TFR1
Newbie
Newbie


Joined: 05 November 2009
Location: India
Online Status: Offline
Posts: 7
Posted: 05 November 2009 at 8:44am | IP Logged Quote TFR1

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 View TFR1's Profile Search for other posts by TFR1
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 06 November 2009 at 2:38am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
TFR1
Newbie
Newbie


Joined: 05 November 2009
Location: India
Online Status: Offline
Posts: 7
Posted: 08 November 2009 at 11:34pm | IP Logged Quote TFR1

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 View TFR1's Profile Search for other posts by TFR1
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 09 November 2009 at 4:54am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
TFR1
Newbie
Newbie


Joined: 05 November 2009
Location: India
Online Status: Offline
Posts: 7
Posted: 09 November 2009 at 6:36am | IP Logged Quote TFR1

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 View TFR1's Profile Search for other posts by TFR1
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 10 November 2009 at 2:17am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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