Re: Redirecting to PHP script
| From: | php3 at developersdesk dot com | Date: | Wed, 21 Jun 2000 23:02:31 +0000 |
| Subject: | Re: Redirecting to PHP script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2542@lists.php.net to get a copy of this message | ||
Addressed to: "Nick Talbott" <nickt@powys.gov.uk>
php-general@lists.php.net
** Reply to note from "Nick Talbott" <nickt@powys.gov.uk> Wed, 21 Jun 2000 11:27:28
+0100
>
> Hello, new list!
>
> I wonder if anyone has a suggestion to how I might make the following
> work (better than the way I am currently doing it). Sorry, this is
> going to take a bit of explaining :-)
>
> What I am doing is this: (PHP as Apache module on Linux)
>
> Someone accesses a site using a url like www.mysite.org/john
>
> Now the resource (file or directory) "john" will not exist. What I
> want to do is to remap that url to a php script that does a database
> lookup on "john" and generates the site from a template.
>
What I would do:
Change the url you hit to
www.mysite.org/info/john
In the VirtualHost block for www.mysite.org add:
<Location /info>
ForceType application/x-httpd-php
</Location>
The file info in your DocumentRoot for www.mysite.org is a php
program that uses $PATH_INFO to extract john from the incoming url
and lookup the data. (echo it, or use phpinfo() to see what you get.)
I still haven't figured out a way to make this work without having a
file that you name within the top level directory for the php code, but
that isn't a problem for me, it just makes the url a little longer.
Rick Widmer
Internet Marketing Specialists
www.developersdesk.com