I always use the same mode_rewrite rules:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
With this rules everything is forwared to index.php.
So you are free to implement every url logic with PHP.
You can get the request uri with $_SERVER['REQUEST_URI']
and do whatever you want.
It is nice to have a Routing class with regex rules to parse the uri.
Look at an example here and also read
how the big frameworks like Zend, Code Igniter etc. do it.
(The rewrite rule I provided is from Zend Framework by the way)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…