.htaccess does not understand ^www\\.
rule
#do not use this, because i want to redirect from https://www.somedomain.com
#RewriteCond %{HTTPS} off
You have an additional condition with [OR]
that can cause too many redirects. Fix it by using:
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.somedomain\.com$ [NC]
RewriteRule ^/?$ https://somedomain.com [L,R=301]
Completely clear browser cache before testing this.
This works will all urls with parameters and without. And it is true, it is very important to clear cache and try to relaod page several times, in several different browsers. Otherwise, some old rules may apply.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^somedomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.somedomain\.com$ [NC]
RewriteRule ^(.*)$ https://somedomain.com%{REQUEST_URI} [L,NE,R=301]
Results are :
somedomain.com --> https://somedomain.com
www.somedomain.com --> https://www.somedomain.com
somedomain.com/folder/file --> https://somedomain.com/folder/file
www.somedomain.com/folder/file --> https://www.somedomain.com/folder/file
TO make things faster:
DirectoryIndex /index.php
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^typejoy\.biz$
#RewriteCond %{HTTP_HOST} ^typejoy\.biz$ [OR]
#RewriteCond %{HTTP_HOST} ^www\.typejoy\.biz$ [NC]
RewriteRule ^(.*)$ https://typejoy.biz%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.typejoy\.biz$ [NC]
RewriteRule ^(.*)$ https://typejoy.biz%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{HTTP_HOST} ^www\.typejoy\.biz$ [NC]
RewriteRule ^(.*)$ https://typejoy.biz%{REQUEST_URI} [L, NE,R=301]
i believe you should not not put L
if there are more rules