Link to home
Start Free TrialLog in
Avatar of Igiwwa
Igiwwa

asked on

Get SCRIPT_NAME after mod_rewrite changes URL

I am using mod_rewrite to optimize my site for better search engine placements without losing people going to my old pages.

For example, I am changing

http://www.mysite.com/cgi-bin/script.cgi?483&Experts 
to
http://www.mysite.com/483/Experts.html

I want my new URLS to be indexed by Google, and I want my old URLS to be un-indexed.

My plan was to

if SCRIPT_NAME contains cgi-bin{
   display <META NAME="GOOGLEBOT" CONTENT="NOINDEX, NOFOLLOW">
}

Unfortunately, no matter which URL I go to, SCRIPT_NAME has the value of cgi-bin/script.cgi, and not the 483/Experts.html.  Is there any way to get the actual URL the page is being viewed at?

Thanks.
Avatar of ahoffmann
ahoffmann
Flag of Germany image

have a look at mod_env, in particular the SetEnv and PassEnv directives
Avatar of Igiwwa
Igiwwa

ASKER

Thank you for your comment ahoffmann, but I'm afraid I do not understand how to use these commands in this context.  All the examples I found just showed how to use these commands to pass static variables to scripts.  Is there a way that I could use these commands to set a server variable if and only if mod_rewrite rewrote a page?
ASKER CERTIFIED SOLUTION
Avatar of _nn_
_nn_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial