RewriteEngine On RewriteOptions MaxRedirects=1 RewriteCond %{REQUEST_FILENAME} -d RewriteRule (.*) - [L] # | If it ends with norw, then no rewrite RewriteCond %{QUERY_STRING} norw$ RewriteRule .* - [L] # | # | If there's a src= query string then do # | a - pass through, which tricks mod_rewrite # | into not calling itself again. # # | The [L] directive is misleading, mod_rewrite # | just keeps getting called for each "new" query # | which is the result of each rewrite. # | RewriteCond %{REQUEST_FILENAME} saShowCode.php RewriteCond %{QUERY_STRING} ^src=.*$ RewriteRule (.*) - [L] # | an similarly for our download RewriteCond %{REQUEST_FILENAME} saDownloadCode.php RewriteCond %{QUERY_STRING} ^src=.*$ RewriteRule (.*) - [L] # ------ # | # | Take any reference here into an invocation of # | saShowCode to show it as beautiful source # | RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)\.dl$ saInfrastructure/saShowCode.php?src=/src/$1&download=1 [L] RewriteRule ^(.+)$ saInfrastructure/saShowCode.php?src=/src/$1 [L] #EOF