I have this in my *.conf file ( I got this from someone else, not sure whether there is a bug or not), which I don't quite understand:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} mycompany.com
RewriteRule ^$ http://mycompany.com/login [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
I roughly understand what it does; first it checks whether the incoming request is mycompany.com, if yes, then redirects to http://mycompany.com/login.
Then, what is the next condition to check? The fact that there is this
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
come before the RewriteRule ^$ http://mycompany.com/login [L] is confusing me.
Is there anyway to rewrite the above script in a RewriteCond, RewriteRule, RewriteCond, RewriteRule format?