On Fri, Jul 8, 2011 at 12:13 PM, Jeroen Geilman <jer...@adaptr.nl> wrote:
> 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.

That works. Near as I can tell this does precisely what was asked.

  Alias /base/images /path/to/base/html/images
  Alias /base/script /path/to/base/html/script
  Alias /base/css /path/to/base/html/css
  Alias /base /path/to/base/html/index.php

  <Files /path/to/base/html/index.php>
      AcceptPathInfo on
  </Files>

No mod_rewrite hackery.

Thanks,
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-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to