This configuration is used to rewrite a URL to a sub-directory for versioning purposes, while also pushing the entire query string in a single GET variable called “request”, so as to strip out the question mark from the URL.
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule (www/.*)$ 2.0/public/$1 [L]
RewriteRule ^(.*+)$ 2.0/public/index.php?request=$1 [L]
DirectoryIndex index.php
I patched this together and by some miracle it works for my purposes, but I’m still not 100% sure why. I need all these lines for it to work correctly. Specifically I need help with line 2 and 3.
I understand that the [L] flag stops processing the rewrite of the current request, and then makes a new request, which needs to be processed again according to the rules (so that probably explains line 2). What is the purpose of line 3?
Let’s first number your lines, because it’s not clear what you’re referring to:
Now, let’s try to explain what each line means: