Hi Soefara,
We also use a .htaccess trick to get the requests to our index.php script:
RewriteEngine on
RewriteRule ^index_php/(.*) index.php?$1
(this requires your internet provider to make a setting to allow url
rewriting).
But down from index php we use request handlers, which are objects, much
like servlets, only we create a new request handler for each request (In
Java, servlets may be reused, of even handle multiple requests at the
same time). In combination with request forwarding request handlers can
act like filters: For example, this is how our website's
LicenseAgreementAction reacts to accepting the the license agreement
before downloading:
function doAgreed()
{
$this->useClass('Menu', 'beheer');
$forwardData = array(
'pntType' => 'Menu',
'id' => Menu::getDownloadMenuId(),
'download' => $this->requestData['download'],
'pntHandler' => 'WebStartDownloadPage'
);
$this->forwardRequest($forwardData, 'agreed');
}
This creates an instance of the class WebStartDownloadPage and forwards
the requestData. The page then produces the output that starts the
download. As you can see it creates new requestData for forwarding
(makes the page show the download menu), only 'download' is copied from
the original requestData.
Greetings,
Henk Verhoeven,
www.phpPeanuts.org.
Soefara wrote:
[color=blue]
> Wow, that's a really interesting hack, Pedro :)
>
> I've never seen people actually use .htaccess and ErrorDocument
> to filter requests like that. Thanks for sharing this - it looks
> like it will do what I want :)
>
> Soefara
>
>
>[color=green]
>>I do that with Apache's ErrorDocument
>>
>>0. Be sure Apache AllowOverride is set to include FileInfo
>>1. Create Directory "Aaaa"
>>2. Create an .htaccess there with
>> ErrorDocument 404 /Aaaa/index.php
>>3. Create /Aaaa/index.php as (for example):
>> <?php
>> echo $_SERVER['REQUEST_URI'];
>> ?>
>>4. Go to
http://www.mydomain.com/Aaaa/Bbbb/Cccc
>>
>>5. and see the resulting page:
>> /Aaaa/Bbbb/Cccc
>>
>>HTH[/color][/color]