| Author |
|
Spec_David Newbie

Joined: 25 June 2008
Online Status: Offline Posts: 11
|
| Posted: 25 June 2008 at 12:13pm | IP Logged
|
|
|
On one of our recent projects we used ISAPI Rewrite on our web server to rewrite Wildcard domains. We got our rewrite rules working with the help of these support forums (thanks for that), but now we would like to track the original url. We have attempted to use the asp native functionality with the "Server" associative array. Here is a snippet of our code:
**********************
<input type="hidden" name="RequestUrl" id="RequestUrl" value="<%# Request.ServerVariables["HTTP_X_REWRITE_URL"] %>" />
********************** This is our hidden field which stores the original requested url, however, it does not seem to do this. Instead, it stores the current url as if it was passing through 2 filters and storing the requested url after it was passed through the first filter. There is however, only one global set filter on our web server (and that is the ISAPI Rewrite.dll). If it will help any, I have included the rewrite rules also, they work perfectly:
**********************
# new condition RewriteCond Host: .*(ionagradpro)\.com RewriteRule (.*) http\://www.ondemandcollateral.net/IONA/index.aspx?id=1 [I,RP]
**********************
Any help you can offer would be of great appreciation.
Oh and PS: We've tried the 'U' post-operator to unmangle the log, but it is undocumented as to where this log is and upon trying this, the "log" does not refer to the address bar where the url is located.
|
| Back to Top |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7460
|
| Posted: 30 June 2008 at 4:33pm | IP Logged
|
|
|
Since you have a redirect here a client performs a second request with a new URI. And this URI will be written to the X-Rewrite-URL. There is no information about an old URI in the 2nd request. If you need it you will have to pass it to a new URI explicitly. For example, in a query string parameter.
|
| Back to Top |
|
| |
Spec_David Newbie

Joined: 25 June 2008
Online Status: Offline Posts: 11
|
| Posted: 01 July 2008 at 10:19am | IP Logged
|
|
|
Gotcha, without the 'RP' tag, it no longer functions correctly. So I must use a query string parameter. However, looking at the rewrite rule above with a small modification:
********* # new condition RewriteCond Host: .*(ionagradpro)\.com RewriteRule (.*) http\://www.ondemandcollateral.net/IONA/index.aspx?id=1request=$1 [I,RP] *********
a hit comes in like:
********* frank.ionagradpro.com *********
and it redirects to:
********* http://www.ondemandcollateral.net/IONA/index.aspx?id=1request=ionagradpro *********
It still appears to be working correctly, but the request url is simply the domain (as there is no folder extension). However, is there anyway to retreive the wildcard portion prior to the actually domain?
|
| Back to Top |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7460
|
| Posted: 01 July 2008 at 4:20pm | IP Logged
|
|
|
And what would you like to get as a rewriting result for that request?
|
| Back to Top |
|
| |
Spec_David Newbie

Joined: 25 June 2008
Online Status: Offline Posts: 11
|
| Posted: 02 July 2008 at 10:15am | IP Logged
|
|
|
Preferably something along the lines of:
********* http://www.ondemandcollateral.net/IONA/index.aspx?id=1request=frank.ionagradpro.com *********
If its possible, would be amazing :D I just really need the wildcard portion more then anything. So even this would suffice:
********* http://www.ondemandcollateral.net/IONA/index.aspx?id=1request=frank *********
In dealing with wildcards, I half felt it would be an issue, but if you can make this work, I'd be extremely grateful!
|
| Back to Top |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7460
|
| Posted: 03 July 2008 at 6:06pm | IP Logged
|
|
|
RewriteCond Host: (.*\.ionagradpro\.com)
RewriteRule .* http\://www.ondemandcollateral.net/IONA/index.aspx\?id=1request=$1 [I,RP]
|
| Back to Top |
|
| |
Spec_David Newbie

Joined: 25 June 2008
Online Status: Offline Posts: 11
|
| Posted: 09 July 2008 at 9:32am | IP Logged
|
|
|
Works great, thanks Lexey, appreciate all the help.
|
| Back to Top |
|
| |
Spec_David Newbie

Joined: 25 June 2008
Online Status: Offline Posts: 11
|
| Posted: 09 July 2008 at 9:33am | IP Logged
|
|
|
Oh and just for future reference, I added an ampersand between the id and the request so asp would perceive it as two separate variables for a GET.
|
| Back to Top |
|
| |