I would like to create an apache redirect of all .php requests in a specific directory to index.php. In index php I would like to include the file and create an instance of the class.
for example:
mySite.com/directory/classname.php
would be re-directed to mySite.com/directory/index.php
index.php would automatically include_once classname.php
and create instance of classname if the file exists.
I don't want to lose get or post values. I only want .php files redirected
Here is what I have figured out so far, based on understanding of manual & others questions
in .htaccess
## turn on re-write engine
RewriteEngine on
## base url
RewriteBase /
## ignore files??
## RewriteCond %{REQUEST_FILENAME} !-f
## ignore directories
RewriteCond %{REQUEST_FILENAME} !-d
## not index.php
RewriteCond %{REQUEST_FILENAME} !^index.php [NC]
## if file does not exist then ignore
RewriteRule ^(.*)$ index.php?param=$1 [QSA,L]
in index.php
$path = $_SERVER["SCRIPT_NAME"];
$path = basename($path, ".php");
include_once $path;
$path = new $path;