CyberPanel Community

how to redirect any subdomain to main domain using .htaccess

fa
faizakbar18 #1

hello,
im new with cyberpanel, im using this for wordpress, i want redirect any sub-domain to main domain with .htaccess, i was try edit rewrite rules and add this code below LSCACHE and before wordpress rules

RewriteCond %{HTTP_HOST} ^(.+)\.mydomain\.com$ [NC]
RewriteRule ^ http://mydomain.com/ [L,R]

but not working, have any solution?

2 replies

Sign in to reply