Robbit
Robbit

Reputation: 1577

Handle http requests for any page by one php file

I want to handle all requests for http://www.example.com/any/possible/subpage in a way that they still appear in the requesting browser under the full URL but will all answered by one single php file http://www.example.com/any/index.php (like Zend Framework does). The index.php uses the /possible/subpage path to deliver the requested stuff.

How can I do that? Is this a matter of configuring .htacces, only? Thank you very much.

Upvotes: 0

Views: 686

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

in the "any" folder, add this to the htaccess file:

RewriteEngine On
RewriteCond $1 !index\.php
RewriteRule ^(.*)$ index.php [L]

if you need the "possible/subpage" part to be passed in as a parameter, then the rule line needs to look like:

RewriteRule ^(.*)$ index.php?url=$1 [L]

Upvotes: 1

Related Questions