- Code: Select all
# aaa section
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} aaa/(.*)$
RewriteRule ^aaa/(.*)$ aaa.php?a=$1 [L]
#bbb section
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} bbb/(.*)$
RewriteRule ^bbb/(.*)$ bbb.php?a=$1 [L]
#ccc section
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ccc/(.*)$
RewriteRule ^ccc/(.*)$ ccc.php?a=$1 [L]
What I'm trying to achieve is the relevant PHP script being called depending on the REQUEST_URI, e.g. if the REQUEST_URI contains aaa, then aaa.php is used, but only id the REQUEST_FILENAME is not a directory or real file.
Does anyone know whether the same thing can be achieved without replicating all of the RewriteCond statements as I've done here?
Any help much appreciated.
Thanks.