REDIRECT_QUERY_STRING weirdness ... redirecting from one file to another
| From: | Erica Douglass | Date: | Sat, 23 Feb 2002 22:37:45 +0000 |
| Subject: | REDIRECT_QUERY_STRING weirdness ... redirecting from one file to another | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85963@lists.php.net to get a copy of this message | ||
Hi,
I would like any file under the root of a certain domain name to redirect to
a PHP template file.
For instance, I would like a request for /services/ to redirect to
http://myhost/index.php?path=/services/ . This
is similar to what PHP.Net
does with their function lookup shortcut (where you can go to
http://php.net/function-name instead of the longer
equivalent.)
I have it set up with mod_rewrite as follows:
RewriteEngine on
RewriteRule ^(.+) /path/to/index.php?path=$1 [L]
The only problem is that Apache is considering this a redirect, and is thus
overwriting my $1 with the name of the current file (index.php.) The only
place I can find the original file is
HTTP_SERVER_VARS["REDIRECT_QUERY_STRING"]. Is there a way to pull out the
name of the original file without going through extracting $HTTP_SERVER_VARS
and the like?
BTW, I know there was a post on how PHP.Net did the function shortcut a
while back. If someone can post a link to that again, I'd be grateful. I
can't seem to find it.
Thanks!
Erica