ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Implementing MVC in PHP: The Controller
Subject:   mod_rewrite
Date:   2006-08-03 06:46:21
From:   whitedevel
thx for this article joe!
the above-mentioned mod_rewrite rueles didn't work for me. so i did some modifications of the regexs. the following works fine for me:

############################################


RewriteEngine on
Options +FollowSymLinks


RewriteRule index.php - [L]



RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^(.[^/]*)[/]?$ /index.php?module=$1 [L,QSA]


#RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^(.[^/]*)/(.[^/]*)[/]?$ /index.php?module=$1&class=$2 [L,QSA]


RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^(.[^/]*)/(.[^/]*)/(.[^/]*)[/]?$ /index.php?module=$1&class=$2&mode=$3 [L,QSA]


############################################