Solved

Get SCRIPT_NAME after mod_rewrite changes URL

Posted on 2003-11-06
3
301 Views
Last Modified: 2013-12-25
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.
0
Comment
Question by:Igiwwa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9697036
have a look at mod_env, in particular the SetEnv and PassEnv directives
0
 

Author Comment

by:Igiwwa
ID: 9704300
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?
0
 
LVL 16

Accepted Solution

by:
_nn_ earned 250 total points
ID: 9748605
Never used it myself, but according to http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#EnvVar you could use SCRIPT_URL or SCRIPT_URI instead of SCRIPT_NAME.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question