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: newby: little help with a new rule
Author
Message |
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 13 October 2010 at 6:51pm

Hello,

I have just found the ISAPI Rewrite module.  I am new to the software and only really need it for this one thing.  instructions are complicated, as expected given how poerful the software is.  It will probably take me a lot longer for me to learn than to pitch the question, so here it goes.

I need to rewrite a URL in some cases as follows:

If the URL being requested is as follows:

www.mydomain.com?a_aid=1234 (that is, if it has the variable a_aid passed in the query)

then redirect to:

http://anotherbox.mydomain.com?a=1234&p=www.mydomain.com

so that the page requested is passed as p and the original a_aid is renamed to a and passed as it is.

can anyone help please?

thank you

Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 13 October 2010 at 7:14pm

ps:  if the URL does not have a_aid passed in it, then I just want to serve the page that was called.  thank you
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 14 October 2010 at 2:08am

Not sure what version you've downloaded, but as you posted the question into v2 forum, I provide you the rules for ISAPI_Rewrite2:

[ISAPI_Rewrite]
RewriteCond Host: (.+)
RewriteRule \?a_aid=(\d+) http\://anotherbox.mydomain.com\?a=$2&p=$1 [I,RP]

P.S. I'm not sure it's possible to put question mark right after domain name without slash (/).

__________________
Regards,
Anton
Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 14 October 2010 at 10:28am

thank you
Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 14 October 2010 at 3:39pm

any idea why I can't save the rule in the httpd.ini file?

it says can't create the c:\program files\Helicon....

make sure that the path and file name are correct.

 

 

thank you much

Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 14 October 2010 at 4:48pm

hrm...ok I found it was file permissions that I can't save.

but the rule is not working.  I installed the lite version, so I pasted this rule into the httpd.ini in the program files folder.  Is this correct?

 

thank you much

Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 15 October 2010 at 12:32am

is v3 any easier?
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 15 October 2010 at 1:01am

"is v3 any easier?"
- well, it has Apache-compatible syntax and some additional features which are not necessary for what you want to do for now.

"I installed the lite version, so I pasted this rule into the httpd.ini in the program files folder. Is this correct?"
- yes, it should work from there. Please try to fix the rules like:

[ISAPI_Rewrite]
RewriteCond Host: www\.mydomain\.com
RewriteRule \?a_aid=(\d+) http\://anotherbox.mydomain.com\?a=$2&p=$1 [I,RP]

And show the EXACT request you are trying to make working.

__________________
Regards,
Anton
Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 15 October 2010 at 4:39pm

ok I installed v3 instead, hoping I could work it easier but no...anyway here is an example of what I'm trying to do:

a browser request a page with the query string a_aid in it, I need to process it.  otherwise serve the page that was requested.  It may have other variables but I only care about a_aid

process as follows.

 

example:

browser requests http://www.mydomain.com/folder/page.htm?a_aid=123&b_bid=31f

note that b_bid may or may not be in the URL.  I only really care about a_aid

the above URL will redirect the browser to:

http://anotherbox.mydomain.com/redirect.php?a_aid=123&p=http://www.mydomain.com/folder/page.htm

so...

it passes a_aid and then adds p= (the original page that was called, w/out the query string)

if the URL does not have a_aid in the can ignore it and serve up the page that was requested.

thank you  very much for the assistance.

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 18 October 2010 at 3:20am

The config for v3 will look like:

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteCond %{QUERY_STRING} a_aid=(\d+)
RewriteRule ^folder/page\.htm$ http\://anotherbox.mydomain.com/redirect.php\?a=%1&p=http\://%{HTTP_HOST}%{REQUEST_URI} [I,RP]

__________________
Regards,
Anton
Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 18 October 2010 at 4:38pm

Hi Anton,

I appreciate your help and I see where you are going with that rule.  Only issue is that I still don't have it working :)

it is not even firing off, so maybe in the RewriteCond?

# Helicon ISAPI_Rewrite configuration file

# Version 3.1.0.78

RewriteBase /

RewriteCond %(QUERY_STRING) a_test+(\d+)

RewriteRule .* http\://cp.mydomain.net/aff.php\?aff=%1&p=http\://%{HTTP_HOST}%{REQUEST_URI} [I,RP]

 

I changed the rewriterule a bit because I need it firing on all URL's, not just specific folders if a_test is passed in the query string.

so only issue now is that it's not firing at all.    I am pulling up something like www.mydomain.com/?a_test=123

thank you very much

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 19 October 2010 at 2:55am

Please notice that QUERY_STRING is in {} in my example and in () in yours which is incorrect.
The line should be:

RewriteCond %{QUERY_STRING} a_test=(\d+)

__________________
Regards,
Anton
Back to Top
 
BarrySDCA
Newbie


Joined: 13 October 2010
Posts: 9
Posted: 19 October 2010 at 11:12am

Hi Anton,

THANK YOU VERY MUCH!!!!!!!

You didn't have to help me but you did - thank you

 

 

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