This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: 301 rewrite on search URL
Author
Message |
ebijs
Newbie


Joined: 21 November 2004
Location: Netherlands
Posts: 22
Posted: 13 August 2010 at 6:29am

Hi,

I'm new to ISAPI Rewrite and I'm not familiar with regular expressions.
Version: 2.12 installed on the server.

I need a 301 rule which rewrite the following:

301 redirect

http://www.domain.com/dir/search.aspx?keyword=keyword1+keyword1+keyword1

to

http://www.domain.com/newdir/csearch.aspx?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=key
word1%20keyword2%20keyword3

Thanks.

Ebijs.


Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 13 August 2010 at 7:01am

Please try to use the following:

[ISAPI_Rewrite]
RewriteRule /dir/search.aspx?keyword=([^+]+)+([^+]+)+([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1\%20$2\%20$3 [I,RP]

__________________
Regards,
Anton
Back to Top
 
ebijs
Newbie


Joined: 21 November 2004
Location: Netherlands
Posts: 22
Posted: 13 August 2010 at 8:08am

Hi Anton,

That was quick. The provided rewrite is however not working. Also no parse errors.

The keyword could anything, multiple search keywords. 1,2 or 5. Rewrite is on one and teh same domain.

Maybe this is better?

/olddir/search.aspx?keyword=keyword1+keyword2+keyword3
(can be mulple keywords. In this sample 3)

TO

/newdir/csearch.aspx?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=key
word1%20keyword2%20keyword3

Sijbe.
Back to Top
 
ebijs
Newbie


Joined: 21 November 2004
Location: Netherlands
Posts: 22
Posted: 15 August 2010 at 2:41am

Anton, can you help out please?
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 16 August 2010 at 3:25am

Please try it with some fixes:

[ISAPI_Rewrite]
RewriteRule /dir/search\.aspx\?keyword=([^+]+)\+([^+]+)\+([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1\%20$2\%20$3 [I,RP]

__________________
Regards,
Anton
Back to Top
 
ebijs
Newbie


Joined: 21 November 2004
Location: Netherlands
Posts: 22
Posted: 16 August 2010 at 1:54pm

Anton,

This seems to be working for only 3 search keywords. Can it also be done for one, or 2. Or 1 and 2 keywords.
Maybe an user searches for 5 keywords.

What is the best way to handle?

Sijbe.
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 17 August 2010 at 2:36am

I would suggest writing separate rule for 1 to 5 keywords, 'cause the generic rule will be too complicated:

[ISAPI_Rewrite]
RewriteRule /dir/search\.aspx\?keyword=([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1 [I,RP]

RewriteRule /dir/search\.aspx\?keyword=([^+]+)\+([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1\%20$2 [I,RP]

RewriteRule /dir/search\.aspx\?keyword=([^+]+)\+([^+]+)\+([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1\%20$2\%20$3 [I,RP]

RewriteRule /dir/search\.aspx\?keyword=([^+]+)\+([^+]+)\+([^+]+)\+([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1\%20$2\%20$3\%20$4 [I,RP]

RewriteRule /dir/search\.aspx\?keyword=([^+]+)\+([^+]+)\+([^+]+)\+([^+]+)\+([^+]+) http\://www.domain.com/newdir/csearch.aspx\?
CategoryID=0&ManufacturerID=0&SectionID=0&PriceRange=0&SortBy=1&PageSize=50&AndOr=AND&DisplayMode=Grid&Search=$1\%20$2\%20$3\%20$4\%20$5 [I,RP]

__________________
Regards,
Anton
Back to Top
 
ebijs
Newbie


Joined: 21 November 2004
Location: Netherlands
Posts: 22
Posted: 18 August 2010 at 7:56am

Thanks for teh great support Anton. Have a nice day!

Ebijs.
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