root and sub domain redirection

KSA

Well-known member
Long story short, I have xenforo on root directory (example.com) and WordPress on subdirectory (example.com/WordPress). Url redirection to non-www https works fine in root but www.example/Wordpress redirects to example.com.

here is my htaccess redirect rule

RewriteCond %{HTTPS} !^on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]

Where could Iv gone wrong?
 
I use this for HTTPS + www redirect

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
 
Top Bottom