I've learned some things about .htaccess, but mostly I've learned that programming it is deep black magic. The most important thing is "Don't use mod-rewrite unless you absolutely need to". All the fancy stuff is better off done by the PHP (or whatever language you're using) code.
Don't do:
RewriteEngine On
RewriteBase /
RewriteRule ^([^/\.]+)/$ /index.php?main=$1&part=$1 [QSA,L]
RewriteRule ^([^/\.]+)/([^/\.]+)$ /index.php?main=$1&part=$2 [QSA,L]
to map your site to your index page; do:
FallbackResource /index.php
And in index.php
parse the $_SERVER['REQUEST_URI']
to get your page/subpage arguments. Much easier to debug!
And to use FallbackResource
you need to be running Apache 2.2, so get a good web host.
Leave a Reply