Solved

Get SCRIPT_NAME after mod_rewrite changes URL

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
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 dynamically set the form action using jQuery.

617 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