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
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Need to escape ampersand & in RewriteRule Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bugmenot
Newbie
Newbie


Joined: 19 December 2008
Online Status: Offline
Posts: 9
Posted: 19 December 2008 at 6:40am | IP Logged Quote bugmenot

The following RewriteRules don't work:
RewriteRule /index.php?page=vacatures&opt=vacature&id=6 http://www.stormmc.nl/vacatures/ [I,O,RP,L]
RewriteRule /index.php?page=vacatures&opt=vacature&id=10 http://www.stormmc.nl/vacatures/ [I,O,RP,L]
RewriteRule /index.php?page=vacatures&opt=vacature&id=11 http://www.stormmc.nl/vacatures/ [I,O,RP,L]

etc...

How do I escape the & in the url?

Thanks!


Back to Top View bugmenot's Profile Search for other posts by bugmenot
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 8119
Posted: 19 December 2008 at 3:04pm | IP Logged Quote Lexey

This could be done with the single rule:

RewriteRule /index\.php\?page=vacatures&opt=vacature&id=\d+ http\://www.stormmc.nl/vacatures/ [I,RP]
Back to Top View Lexey's Profile Search for other posts by Lexey
 
bugmenot
Newbie
Newbie


Joined: 19 December 2008
Online Status: Offline
Posts: 9
Posted: 22 December 2008 at 3:51am | IP Logged Quote bugmenot

It works like a charm!
Thank you very much
Back to Top View bugmenot's Profile Search for other posts by bugmenot
 
johneqr
Newbie
Newbie


Joined: 30 April 2009
Online Status: Offline
Posts: 19
Posted: 17 July 2009 at 3:02pm | IP Logged Quote johneqr

I have similar need - to escape question mark "?", but "\" seems never work for me. It alwasy gave me 404 not found error. Any thought?

what I put :

RewriteRule ^partner\.asp\?source=forrent$ http://www.myweb.com [NC,R=301,L]

 

 

Back to Top View johneqr's Profile Search for other posts by johneqr
 
Anton
Admin Group
Admin Group


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

You are probably using ISAPI_Rewrite v3. And the config for yu will look like:

RewriteBase /
RewriteCond %{QUERY_STRING} ^source=forrent$ [NC]
RewriteRule ^partner\.asp$ http://www.myweb.com [NC,R=301,L]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
johneqr
Newbie
Newbie


Joined: 30 April 2009
Online Status: Offline
Posts: 19
Posted: 20 July 2009 at 9:07am | IP Logged Quote johneqr

Thanks Anton!

Yes, I do use ISAPI_Rewrite v3. From the document it look in v3 query string has to use the way you advised, and escape "\" no longer supported.

My problem is we have quite messy needs, there are lots of redirects using query strings that have same variable names and values, like "key=" but whole strings are different and destinations are different, example:

market/navigation.aspx?key=CA ->  http://www.myweb.com/Los-Angeles.aspx

content/rentwithequity_market.asp?key=CA -> http://www.myweb.com/content/my-market.aspx#buildersCalifornia

(by the way, the "#" always give me problem too, how could I handle it?)

Also, how could I handle multiple variables in a query string, like

market/OnlineAvailability/AvailabilityResults.aspx?PropID=595&FPid=68109&ILSID=6 ->

http://www.myweb.com/corona-hills/marquessa.aspx

Thanks in advance for all your helps!

 

Back to Top View johneqr's Profile Search for other posts by johneqr
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 21 July 2009 at 4:31am | IP Logged Quote Anton

You may consider using mapfiles if you have a lot of different patterns.
You may find examples here.

Try to use mapfile.txt like this:

market/navigation.aspx?key=CA   /Los-Angeles.aspx
content/rentwithequity_market.asp?key=CA /content/my-market.aspx#buildersCalifornia
market/OnlineAvailability/AvailabilityResults.aspx?PropID=595&FPid=68109&ILSID=6 /corona-hills/marquessa.aspx

And the config like:

RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteCond %{QUERY_STRING} (.*)
RewriteCond ${mapfile:($1?%1)|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.+)$ ${mapfile:($1?%1)} [NC,L,R=301]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
sags
Newbie
Newbie


Joined: 13 January 2010
Online Status: Offline
Posts: 3
Posted: 13 January 2010 at 10:30pm | IP Logged Quote sags

I am try to escape a # sign. I have tried implement the above with no luck.

What i am trying:

RewriteRule ^/?/screeningroom$ /screeningroom/Pages/screeningroom.aspx#/featured/ [NC,R=301,L]

Back to Top View sags's Profile Search for other posts by sags
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 14 January 2010 at 5:45am | IP Logged Quote Anton

@sags:

Are you using ISAPI_Rewrite2 or 3?
Please create a new forum topic and give more thorough explanation of what you are trying to get. Provide examples.

__________________
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