Get the URL string a user entered when using .htaccess

I'm currently using an htaccess file to redirect users from

 detail.asp?CategoryID=XX&SubCategoryID=XX&ProductID=XX

to

 catid-XX-subcatid-xx-productid-xx

but I now need to check they've arrived at the correct page. I'm doing this by checking that the query string values are correct. However I'd rather check that the user arrived at

 catid-XX-subcatid-xx-productid-xx 

so that Google doesn't index duplicate content.

So what I'm wondering is if there's a way of finding out the string from the URL bar before the htaccess rewrite.

If I'm on a page

 catid-XX-subcatid-xx-productid-xx

then using VBScript, if I check

 Request.ServerVariables("URL") & Request.ServerVariables("QUERY_STRING")

I get

 detail.asp?CategoryID=XX&SubCategoryID=XX&ProductID=XX

Is there any way of getting the correct URL string?

Answers


The environment variable REQUEST_URI should contain the requested URI.


You could try to use PATH_INFO and parse the requested URI path with ASP:

RewriteRule !^detail\.asp detail.asp%{REQUEST_URI} [L]

The requested URI path should then be available in:

Request.ServerVariables("PATH_INFO")

This reminds me of something like this;

var i = 1+1;
/* lets double check to make sure the cpu has calculated it right.. 
   just in case, I mean, you never know... */

if (i != 2) return ZOMG END OF THE WORLD!!

Need Your Help

How to get the quiz answers from array list?

android text arraylist radio-button

I'm new to android. I'm doing a project on quiz app. I have problem on displaying the question and answers.

Drawing isometric walls

java math isometric

I'm having some trouble with isometric walls.