Should these rules have the [L] flag

below is a bit from my apache directives, should the RewriteRule have the [L] flag applied?

Probably. I don’t know why it wouldn’t. We’d have to ask @Jamie, I think. Any reason we don’t want this to short-circuit at the redirect?

According to the docs, we pretty much always want an L with R.

“You will almost always want to use [R] in conjunction with [L] (that is, use [R,L]) because on its own, the [R] flag prepends http://thishost[:thisport] to the URI, but then passes this on to the next rule in the ruleset, which can often result in ‘Invalid URI in request’ warnings.”

1 Like

@jamie There are some other issues I have noticed with these links, they are in in my private chat, for that redirect issue.

I wouldn’t mind using L with such redirects either. It makes perfect sense in this scenario.

However, we should be careful with the L flag since it tells the server to stop running any more RewriteRules in this context for this request.

And, also, with any of those redirects, we should use R=301 and not just R because the default for R is 302, and 302, unlike 301, isn’t cached by browsers.

@Jamie, but please make no changes before the new Virtualmin release. Everything else we want to fix or improve will go to 8.0.1 a week or two later.

1 Like

I agree, we should add L to these rules since there’s no situation in which we’d want to process any following rules.

1 Like

There are a few other issues with the redirects. When I get later on I will open a GitHub issue and lay them out properly for consideration.

1 Like

Done