I have a client who needs to have many domains running from the same CMS (Joomla). I want to be able to force www.domain.com or www.domain.com.au but not if it is forum.domain.com or forum.domain.com.au etc.
I need to have it work on both http and https URLs.
This is something I have currently but it puts www on front of all subs-domains.
- Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www.//s%{HTTPS} ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)|.*)//((s)on|s.*)$ [OR,NC]
RewriteCond %{HTTP_HOST}/www.//s%{HTTPS} ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))//((s)on|s.*)$ [NC]
RewriteRule ^ http%6://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301]
Having spent many hours looking for a solution (and not finding one) I thought I should ask you experts.
Any pointers would be greatly appreciated.