Multiple alias domains pointing to the same cPanel account are sharing the same .htaccess
file. I need a domain-specific rule that redirects all traffic from aliasdomain.com
to https://www.domain1.com
only if:
HTTP_HOST
is currentlyaliasdomain.com
(with or without WWW and http/https)exclude folder
/medias/
- it must still be accessible fromaliasdomain.com
exclude all
*.jpg
,*.jpeg
,*.png
and*.gif
files (even if the files are in root ofaliasdomain.com
)always redirect to
https://www.domain1.com
root, no wildcard redirect and no redirect to non-ssl httpdomain1.com
needs to be excluded so if the same.htaccess
file is ondomain1.com
it won't interfere.
I tried to adapt various code snippets found on StackOverflow but failed horribly getting it to work :( I asked a question there but mods told me to ask on ServerFault instead so here i am... Help would be really appreciated!