So if I have a URL like http://www.mydomain.com/foo-bar/ it points to a file called fb_index.php (in this case).
And if I have a URL like http://www.mydomain.com/foo-bar/myfile/ it points to fb_myfile.php
I also have URLs such as http://www.mydomain.com/fubar/ which simply point to fubar.php
There will also be actual subdirectories, but the main problem right now is the rulesets I've come up with screw with other internal directories, as well as the root.
Can this be cleaned up, or am I making things too complicated?
Following is the rulesets I've come up with:
- Code: Select all
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R]
RewriteCond %{REQUEST_URI} ^/((.)[a-zA-Z]*)-((.)[a-zA-Z]*)/([0-9a-zA-Z]*)/
RewriteRule ^(.*) /%2%4_%5.php [L]
RewriteRule ^([a-zA-Z]*)-([a-zA-Z]*)$ $1-$2/ [R]
RewriteCond %{REQUEST_URI} ^/((.)[a-zA-Z]*)-((.)[a-zA-Z]*)/
RewriteRule ^(.*) /%2%4_index.php [L]
RewriteCond %{REQUEST_URI} !^/(images|css|js|cgi-bin)/
RewriteCond %{REQUEST_URI} ^/([0-9a-zA-Z]*)/
RewriteRule ^(.*) /%1.php [L]