All pastes #739857 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-17 15:01 UTC
rendered paste body

What I want is,

/                                                          => controllers/home/index.php
controller_name/                                           => controllers/controller_name/index.php
controller_name/action_name                                => controllers/controller_name/action_name.php
controller_name/action_name/anything/might/go/here/100/200 => controllers/controller_name/action_name.php?q=anything/might/go/here/100/200

And that anything that resolves to a non-existent controller or action should reach controllers/home/index.php


.htaccess
---------

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRUle ^/?$ controllers/home/index.php [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/\.]+)/?$ controllers/$1/index.php [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/\.]+)/([^/\.]+)/?(.*)/?$ controllers/$1/$2.php?q=$3 [L,QSA]