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.
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.
have a look at mod_env, in particular the SetEnv and PassEnv directives
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.