I am serving files and application demands using Apache, Application demands use RewriteRule to transmit web addresses that match a pattern to my application servers.

Let me set a specific HTTP header (Cache-control) just for demands that do not match the RewriteConds previously mentioned. Can there be in whatever way to do that without needing an .htaccess file?

I have attempted placing the Header set directive Following the RewriteRule (which utilizes the L flag) however the header still will get applied.

You need to really publish your rewriteRules.

There's certainly something we are able to do for your. First factor I am thinking is setting an atmosphere variable in matching rewriteRules (so some rewriteCond, inverting the prior ones), make use of the [E=myvar:myvalue] tag and employ the final available argument from the Header instruction [env=myvar] to conditionnaly set this Header.

Then you definitely stated:

Can there be in whatever way to do that without needing an .htaccess file?

Well, RewriteRules and .htaccess files are loosely related. Whatever you occur b .htaccess would actually fit better inside a <Directory> instruction having a nice AllowOverride None in your VirtualHost to avoid a looooot of IO procedures from apache, attempting to read a lot of .htaccess files each and every demands.

Second factor, you stated:

I have attempted placing the Header set directive Following the RewriteRule (which utilizes the L flag)

Well the [L] flag prevent several RewriteRules on a single directory to become applied one by one, so that they will not be chained at this time direclty. However after your rewriteRule finishes ([L]) the creation of the rewriteRule will be reapplied around the directory, to ascertain if any RewriteRule (maybe exactly the same one) should be applied.

For this reason we very often see an excessive amount of Internal redirections messages.

The only method to view it happen is by using the RewriteLog /a/file.log and RewriteLogLevel 9 around the VirtualHost (lots of surprises sometimes, some rules are occasionally using a lot an excessive amount of recursions).

A great RewriteCond to known for your is :

RewriteCond %{ENV:REDIRECT_STATUS} ^$

Any rule prefixed with this particular rewriteCond are only applied thefirst time one enters your directory, following the finish of the rules (maybe by having an [L] or because there's no more rule) the end result is going to be re-examined around the direcory rules however with an env variable REDIRECT_STATUS not empty. This Problem tell mod-rewrite to prevent the rule if the env variable is placed.