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: RewriteRule and keep my original URL
Author
Message |
kevineves
Newbie


Joined: 18 October 2010
Posts: 6
Posted: 18 October 2010 at 10:07pm

Hi there, I have ISAPI version 2.9 and running on the IIS 6

here is my RewriteRule:

RewriteCond Host: ^(?!www\.)(?:sp([0-9]{3})\.)somesth\.com\.cn$
RewriteRule (.*) http\://www.somesth.com.cn/sp/index.php?spid=$1 [I,RP]

It works but the problem is it changes original URL(sp123.somesth.com.cn) to target URL(www.somesth.com.cn/sp/index.php?spid=123)

I wanna keep my original URL in browser address bar, how can i fix this?

Thanks a lot!

Back to Top
 
Anton
Admin Group


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

Please change the RP flag at the end with P flag.

__________________
Regards,
Anton
Back to Top
 
kevineves
Newbie


Joined: 18 October 2010
Posts: 6
Posted: 19 October 2010 at 3:20am

Thank you Anton!

I change the RP flag to P flag, but it doesn't work.

IIS shows "Bad Request (Invalid Hostname)".

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 19 October 2010 at 3:32am

Are you using Full or Lite version of ISAPI_Rewrite?
P flag is supported in Full version only.

__________________
Regards,
Anton
Back to Top
 
kevineves
Newbie


Joined: 18 October 2010
Posts: 6
Posted: 19 October 2010 at 3:48am

thanks for your reply,Anton

I use the Full version of ISAPI_Rewrite 2.9.

Here is my httpd.ini:

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 20

# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]

# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]

#-- A/B/C --#
RewriteCond Host: ^(?!www\.)(?:([a|b|c]+)\.)somesth\.com\.cn$
RewriteRule (.*) http\://www.somesth.com.cn/$1$2 [I,R]

#-- SP --#
RewriteCond Host: ^(?!www\.)(?:sp([0-9]{3})\.)somesth\.com\.cn$
RewriteRule (.*) http\://www.somesth.com.cn/sp/index.php?spid=$1 [I,RP]

Is there anything wrong in configuration? sorry I'm a starter of ISAPI...

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 19 October 2010 at 4:21am

So, have you just changed your rule to this:

RewriteCond Host: ^(?!www\.)(?:sp([0-9]{3})\.)somesth\.com\.cn$
RewriteRule (.*) http\://www.somesth.com.cn/sp/index.php?spid=$1 [I,P]

Please try if proxy functionality is working for you at all by putting the following rule at the top of the config:

RewriteRule /test.* http\://www.google.com

Then request yoursite.com/test.
If you get the Google page, the proxy is working fine, otherwise we'll continue investigation.

__________________
Regards,
Anton
Back to Top
 
kevineves
Newbie


Joined: 18 October 2010
Posts: 6
Posted: 19 October 2010 at 4:48am

thank you so much, Anton

I put

RewriteRule /test.* http\://www.google.com

to the top of my httpd.ini, when I visit this url http://www.somesth.com.cn/test, there occurs a 404 error.

It seems the proxy doesn't work...

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 19 October 2010 at 7:06am

Ok, then please check if it's not the case described here: http://www.isapirewrite.com/docs/#proxyConfig

__________________
Regards,
Anton
Back to Top
 
kevineves
Newbie


Joined: 18 October 2010
Posts: 6
Posted: 20 October 2010 at 2:46am

Thank you so much for your time,Anton!

I've been uninstalled the ISAPI version 2.9 and installed the version 3.0 Lite just for test.

I've add the test configuration

RewriteRule /test.* http\://www.google.com

into top of my httpd.ini, and it works now in 3.0 Lite which didn't work anyway in ISAPI version 2.9 Full...

and... another question is

I just wanna keep my original URL in address bar, could I do this in 3.0 Lite?

Thank you so much again.

Best regards,

Kev

Back to Top
 
Anton
Admin Group


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

"I just wanna keep my original URL in address bar, could I do this in 3.0 Lite?"
- proxy functionality, that is needed for you to keep original URL, is available in v3 Full only.
Please note that upgrade from v2 is quite cheap: http://www.helicontech.com/order/#isapi_rewrite3

__________________
Regards,
Anton
Back to Top
 
kevineves
Newbie


Joined: 18 October 2010
Posts: 6
Posted: 20 October 2010 at 8:12pm

Thank you Anton!

I've remove my test enviroment and been back to ISAPI_Rewrite 2.9 Full again.

I didn't make any other configurations and I just modified the default httpd.ini in intallation folder.

Now i found

RewriteRule /test.* http\://www.google.com [I,RP]

this rule works,but

RewriteRule /test.* http\://www.google.com [I,P]

doesn't work anymore, there still shows the 404 error.

I'm so confused of that, pls help me...

Best regards,

Kev

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 28 October 2010 at 1:52am

That sounds really strange.
Could we arrange an online meeting or can I get RDP access to your server to check why this happens.
If yes, please send the access details to [email protected] with reference to this forum post.

__________________
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