Hi guys, I'm having a bit of trouble with my .htaccess file. I have it setup to funnel everything to index.php, but it is not supposed to do this for requests to files that actually exist (like my css). However, given that some of my session variable tracking page views jumps by 2-6 every page load, I suspect it is not working properly. What am I doing wrong? RewriteEngine on # Do not rewrite requests for files and directories that exist # This means you can still place images, javascript, and css # in /home/youraccount/yourdomain.com/ directory (or sub-directories) RewriteCond %{REQUEST_FILENAME} -f # RewriteCond %{REQUEST_FILENAME} -d RewriteRule .* - [last] # Now rewrite every other request to index.php # Sends: http://www.yourdomain.com => http://www.yourdomain.com?__controller=Index&__action=Index&__params= RewriteRule ^/?$ index.php?__controller=Index&__action=Index&__params= [QSA,L] # Sends: http://www.yourdomain.com/Members => http://www.yourdomain.com/index.php?__controller=Members&__action=Index&__params= RewriteRule ^([^/]+)/?$ index.php?__controller=$1&__action=Index&__params= [QSA,L] # Sends: http://www.yourdomain.com/Members/List => http://www.yourdomain.com/index.php?__controller=Members&__action=List&__params= RewriteRule ^([^/]+)/([^/]+)/?$ index.php?__controller=$1&__action=$2&__params= [QSA,L] # Sends: http://www.yourdomain.com/Members/List/Sort/FirstName/Dir/Asc => http://www.yourdomain.com/index.php?__controller=Members&__action=List&__params=Sort/FirstName/Dir/Asc RewriteRule ^([^/]+)/([^/]+)/(.*)/?$ index.php?__controller=$1&__action=$2&__params=$3 [QSA,L] Code (markup): This code: RewriteCond %{REQUEST_FILENAME} -f # RewriteCond %{REQUEST_FILENAME} -d RewriteRule .* - [last] Code (markup): is intended to tell stop execution of any other rules if the file actually exists, but it doesn't appear to be doing that.
Well, you could just add the reverse condition to all other rewriterules as a last resort.. RewriteCond %{REQUEST_FILENAME} !-f