I have the following in my .htaccess file to
- Remove www
- Redirect to https
- remove .php
This is my .htaccess:
# ----------------------------------------------------------------------
# | Redirect to HTTPS & remove www |
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
# ----------------------------------------------------------------------
# | Remove .php extension |
# ----------------------------------------------------------------------
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ /$1.php [L]
When I view the site in Firefox I get the following error:
The page isn't redirecting properly. This problem can sometimes be caused by disabling or refusing to accept cookies
And Chrome warns about too many redirects
The URL is updated to what I would expect (www removed and https added). There are no other redirects in effect
Can anyone spot where I am going wrong?