So I've been asked to clean up the URL's for the web app that we're currently running on apache (version 2.4.9 if so interested), but after messing around with mod re_write commands for a few hours, I think I'm running around in circles. Here's what I'm attempting to do.
If the url is something like this (http://www.foo.bar/admin/index.php ), have it display as http://www.foo.bar/admin
If the url is something like this (http://www.foo.bar/admin/testpage.php ), have it display as http://www.foo.bar/admin/testpage
If the url is something like this (http://www.foo.bar/admin/testpage.php?id=15&foo=www ), have it display as http://www.foo.bar/admin/testpage?id=15&foo=www
So far I have it to where the index.php resolves....mostly.....and the second example resolves....sometimes. Basically the code that I have seems very flaky and only resovles two levels down in the file tree. So I was wondering if anyone here could help me out on this at all? here's what I have in the vhost file (because I didn't want to have to have this in every directory as an .htaccess file)
AllowOverride None
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]