I've got a .htaccess file online I am focusing on which rewrites web addresses from mydomain.com/sub/folder/ to mydomain.com?index.php?controller=sub&view=folder

Regrettably the way in which I have written this means I can not access images, stylesheets along with other linked files any longer. Could anybody let me know just how to exclude specific sites / URL demands in the rewrite rule?

Apologies if this sounds like a little of the newbie question, I am still wrapping my mind for this mod rewrite stuff!

The .htaccess file appears like this:

RewriteEngine on RewriteRule ^([a-zA-Z0-9-]+)/?$ index.php?Controller=$1 RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-_]+)/? index.php?Controller=$1&View=$2

In case your images have been in mydomain.com/images and you're simply connecting for them using relative links around the page mydomain.com/sub/folder/ the browser will try to try to access the look via mydomain.com/sub/folder/images/i.gif. But when you alter your links to absolute links, the browser will properly make an effort to load mydomain.com/images/i.gif. However, the RewriteRule can change it to: mydomain.com/index/php?Controller=images&View=i.gif. To avert this you have to give a couple of RewriteConds:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-_]+)\/?$ index.php?Controller=$1
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)\/? index.php?Controller=$1&View=$2

To ensure that when trying at access a current file/directory, don't rewrite to index.php.