This mod_rewrite is not behaving as expected…
#RewriteRule ([^/]+)/$ articles/index-section.php?section=$1 [L]
When I go to this URL…
http://local.debbie/finance/economy/
…then why does section=‘economy’
The whole point of saying [^/] was to make Apache grab finance and disregard everything after the /.
Also, is it correct that you generally want to place my GENERIC mod_rewrites before more SPECIFIC ones?
My website has “Sections” and “Subsections”, and so I figured that my mod_rewrites would go in this order…
# SHOW SECTION INDEX
#-------------------------------------------------------------------------------
#PRETTY: finance/
#UGLY: articles/index-section.php?section=finance
#Rewrite only if the request is not pointing to a real file.
RewriteCond %{REQUEST_FILENAME} !-f
#Match any kind of Section. PHP will decide if it's valid or not.
RewriteRule ([^/]+)/$ articles/index-section.php?section=$1 [L]
# SHOW SUBSECTION INDEX
#-------------------------------------------------------------------------------
#PRETTY: finance/tax-season/
#UGLY: articles/index-subsection.php?section=finance&subsection=tax-season
#Rewrite only if the request is not pointing to a real file.
RewriteCond %{REQUEST_FILENAME} !-f
#Match any kind of Section and Subsection. PHP will decide if it's valid or not.
RewriteRule (.+)/(.+)/$ articles/index-subsection.php?section=$1&subsection=$2 [L]
Sincerely,
Debbie