I've this somewhat working though you need to comprehend the setup.

With multi-domain support (multiple domain names while using identical copy of software) I have to rewrite Just the sites (which finish cleanly like dir1/ or dir2/).

Aesthetically listed here are in which the files are recommended...



gallery/ (PHP code here)


So I wish to only have sites rewritten to gallery/ while all image files (by extension) are rewritten towards the site1/gallery/image.digital pathways.

Things I have presently rewrites Just the base gallery/ path however it doesn't rewrite much deeper gallery indexes (e.g. gallery/my_gallery/) nevertheless the image exception works too.

RewriteEngine on
RewriteRule ^[^/]*/gallery/$ gallery/$1 [QSA]
RewriteCond %{REQUEST_URI} !\.(gif|jpg|png)$

RewriteCond %{REQUEST_URI} !.*/(gallery|admin|blog)
RewriteRule !\.(css|js)$ index.php

Just how to I capture all sites no matter depth while keeping the look file exception please? I am pleased to make any clarifications in addition to pay a working answer or more-election it.

Works out all I desired to complete was add the file extensions towards the rewrite condition. In fact it is VERY worth noting the rewrite condition must appear before the rewrite rule.

RewriteEngine on
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|mp3|png|swf|xml)$
RewriteRule ^[^/]*/(gallery|admin|blog)(.+) $1$2 [QSA]
RewriteCond %{REQUEST_URI} !.*/(gallery|admin|blog)
RewriteRule !\.(css|js)$ index.php