RE: [PHP-DB] Dynamic sites, to appear static...?
| From: | Ford, Mike [LSS] | Date: | Thu, 04 Sep 2003 10:53:38 +0000 |
| Subject: | RE: [PHP-DB] Dynamic sites, to appear static...? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-30331@lists.php.net to get a copy of this message | ||
On 04 September 2003 11:18, Tristan.Pretty@risk.sungard.com wrote:
> I've been building web sites that use a database backend for
> some time
> now.
> I typically use the format.
> http://www.mysite.com/index.php?page=contact
> http://www.mysite.com/index.php?page=home
> http://www.mysite.com/index.php?page=aboutus
> etc....
>
> My most recent job wants to use differnt pages, so the search engines
> will pick up the url's as clearly defined, and not dynamic, as I
> normally do...
> Is there a way I can still admin the pages, and allow my client to
> add/delete pages, but use static links , without '?page=home' etc...
>
> I hope I've made sence...
> I've discused this with my client, and he said a friend of
> his claimed
> 'that webserver software should have a module or plugin that
> will do this'
> I've never heard of that, have I been living under a rock?
Not even a module (well, except for php!) or plugin. If you're using Apache as your Web server
with mod_php, anything looking like path information following the script name is passed to your
script in $_SERVER['PATH_INFO']. Take a look at, for example:
http://www.lmu.ac.uk:8082/lco/php/support.php/visitors/welcome
Note the position of support.php in that URL -- this URL is processed by running support.php with
$_SERVER['PATH_INFO'] set to '/visitors/welcome', which the script decodes to
decide what it actually needs to display.
There's nothing particularly special in my httpd.conf file to make this work -- the relevant
section is simply:
<Directory "****/lco/php/">
AddType application/x-httpd-php .php
Order allow,deny
</Directory>
As a refinement, if you don't want people to see the .php on the script name, so that the URL
could be (say):
http://www.lmu.ac.uk:8082/lco/php/support/visitors/welcome
you can tweak this to:
<Directory "****/lco/php/">
AddType application/x-httpd-php .php
DefaultType application/x-httpd-php # or ForceType if you prefer
</Directory>
Then you either need a relevant AliasMatch or Rewrite so the above still gets to call support.php,
or you simply upload all your scripts to the server with their bare name to match.
I believe IIS is capable of passing PATH_INFO information, too, if you set it up right, but as I
don't use it I can't be sure (or tell you how it might work!).
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211