PDA

View Full Version : Read URL in browser window after mod_rewrite


dudeshouse
06-05-2009, 01:00 PM
Hi,

Firstly, I need to state I'm using and ISAPI rewrite on IIS, but I'm sure this is the right place to ask this question.

I've got my rewrites working correctly, but the issue I'm having is how to read in the browser URL, rather than the one being served.

I have checked against all the Server.Variables and it's not showing. I'm only getting the rewritten side of things.

To clarify, my rule does something like:
www.domain.com/make/model => /somewhere-else/item.asp

What I would then like to be able to do is read the "make" from the given URL.

Is this still possible or can you only read from the served URL, ie the right hand side of the above translation?

Any help would be greatly appreciated to help me avoid having to reconfigure how a site is working. This is supposed to be a simple work around!

Thanks.

abduraooft
06-05-2009, 01:08 PM
In PHP, there's $_SERVER['REQUEST_URI']

dudeshouse
06-05-2009, 01:10 PM
In PHP, there's $_SERVER['REQUEST_URI']

Thanks for the prompt response. Is there an equivalent in ASP?

Hope so... ;)

abduraooft
06-05-2009, 01:20 PM
Google gives http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_22153712.html,
scroll down(a lot) to see the real answerers !

dudeshouse
06-05-2009, 01:22 PM
Google gives http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_22153712.html,
scroll down(a lot) to see the real answerers !

Yea, I found that one, and that would seem to work for a 404 as it's got a referrer. I need to read directly from the URL in the browser, so it appears that I may be a little stuck.

Using Server.Variables("URL") shows me the rewritten address.

Thanks for the help. Back to the drawing board.

dudeshouse
06-05-2009, 01:39 PM
Just to finish up, as it happens, the ISAPI module I'm using to rewrite on IIS has the facility to do this. There is a flag I can set and then read using another Server Variable.

Thanks again for your time.