Re: Invoking PHP without .php extension?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-07-07 19:54, Michael B Allen wrote:
I want a request like:

   /base/path/to/target?foo=bar

to invoke a particular PHP file for everything under /base.

It seems the usual way (only way?) to do this is with something like:

   AddHandler php5-script .php
   AddType text/html .php
   DirectoryIndex index.php

and with directives like:

   Alias /base /path/to/base/html

   <Directory "/path/to/base/html">
     Options Indexes FollowSymLinks
     AllowOverride None
     Order allow,deny
     Allow from all

     RewriteEngine on
     RewriteBase /base
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-l
     RewriteRule .* index.php [L]
   </Directory>

However this is a disaster. The request for
/base/path/to/target?foo=bar is received inside the PHP script as
/base/index.php/path/to/target?foo=bar. Now the application has to
have intimate knowledge of the presence of the extra /index.php
segment and exclude it from URLs and paths emitted by the application.
The internal representation doesn't match the reality of the external
representation.

So my question is, is there a way to directly invoke a preconfigured
PHP script for everything at / under a certain location without using
the .php extension in the request path?

Alias /your/base/path /usr/share/your.php.file

And set AcceptPathInfo.



Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See<URL:http://httpd.apache.org/userslist.html>  for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux