One of our developers who built the framework that our website uses is no longer with us and I appear to have a stack of issues across the site currently, one being URL rewriting across the site.
This is what we have at the moment:-
RewriteRule ^(.*)/(.*)$ index.php?page_name=$1&sub=$2 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
This currently rewrites URL's correctly in the sense that...
domain.com/index.php?page_name=products would be rewritten to domain.com/products
But if you try to access a path that exists on the server but not in the database such as...
domain.com/fonts this is trying to be rewritten to domain.com/fonts/?page_name=fonts&sub= and throws a redirect loop error in the browser.
I think I need to be rewriting directory paths as well as what we are currently - I'm not too sure whether this is code that has to be rewritten or whether we can easily achieve this from an addition rule in .htaccess.
Edit: To include full rewrite sections from domain following on from Justin's answer below...
RewriteEngine on
RewriteCond %{REQUEST_URI} !\.(jpg|png|gif|css|js|get.php|addon.php|script.php|rss.php|favicon.ico|feed.php|301.php|oldsite/|clientarea/|htc|PIE.php)$
RewriteRule ^(.*)/(.*)$ index.php?page_name=$1&sub=$2 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
## FIXES TRAILING SLASH ##
RewriteRule (.*)([^/])$ http://www.domain.com/$1$2/ [R=301,L]
RewriteRule ^$ home/ [NC,L]
RewriteCond %{HTTPS} ^on$
RewriteCond %{REQUEST_URI} ^/robots.txt$
RewriteRule ^(.*)$ /robots_https.txt [L]