I inherited the following .htaccess file from the previous web developer. I am totally baffled by some of the rules here and getting endless loops on things.
<IfModule mod_security.c>
SecRuleRemoveByID 000014
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
# STRIP .HTML FROM DISPLAY
RewriteCond %{REQUEST_URI} !^/(dashboard|editor/.*)$
RewriteCond %{THE_REQUEST} ^(.+)\.html([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.html$ /$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/(dashboard|editor/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html
RewriteCond %{REQUEST_URI} !^/(dashboard|editor/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
What I'm trying to accomplish is the following:
- Append www. to all incoming URLs
- Redirect all http requests to https
- Display all incoming .html URLs without the .html
We have an angular app in /dashboard and /editor and we need to make sure that we exclude those directories from any rewrite rules.
PLEASE HELP!