Solved

Get SCRIPT_NAME after mod_rewrite changes URL

Posted on 2003-11-06
3
285 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now