views:

243

answers:

2
+2  A: 
RewriteCond %{REQUEST_URI} !^/admin/
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^(.*/)([^/]+)/([^/]+) $1?$2=$3&%1 [L]
RewriteCond %{REQUEST_URI} !^/admin/
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^([^/]+)/ $1.php?%1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin/([a-z]+?)/([a-z]+?)/(.*)$ /admin/index.php?model=$1&view=$2&params=$3 [L,NS]
chaos
You might want to add comments or a paragraph explaining your Conditions.
Nerdling
chaos: thank you for your quick response. It doesn't seem to be working though...? I even tried changing a few things and still no luck :(
Torez
Some edits made. Give it a try now.
chaos
A: 

I’d use this:

RewriteEngine On

# /admin/ rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin/([a-z]+)/([a-z]+)/(.*)$ admin/index.php?model=$1&view=$2&params=$3 [L,NS]
RewriteRule ^admin/ - [L]

# other rules
RewriteRule ^(.*/)([^/]+)/([^/]+)$ $1?$2=$3 [L,QSA]
RewriteRule ^([^/]+)/ $1.php [L,QSA]

The QSA flag (query string append) replace the RewriteCond %{QUERY_STRING} (.*) directives.

Gumbo