methomps Posted September 4, 2009 Share Posted September 4, 2009 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] This code: RewriteCond %{REQUEST_FILENAME} -f # RewriteCond %{REQUEST_FILENAME} -d RewriteRule .* - [last] is intended to tell stop execution of any other rules if the file actually exists, but it doesn't appear to be doing that. Quote Link to comment https://forums.phpfreaks.com/topic/173070-htaccess-dont-touch-files-that-actually-exist/ Share on other sites More sharing options...
methomps Posted December 13, 2009 Author Share Posted December 13, 2009 Thought I'd bump this up to see if anyone had any ideas Quote Link to comment https://forums.phpfreaks.com/topic/173070-htaccess-dont-touch-files-that-actually-exist/#findComment-976398 Share on other sites More sharing options...
cags Posted December 13, 2009 Share Posted December 13, 2009 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Quote Link to comment https://forums.phpfreaks.com/topic/173070-htaccess-dont-touch-files-that-actually-exist/#findComment-976445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.