简体   繁体   中英

How to redirect subdomain of wordpress site to domain root?

I have a wordpress subdomain that I need to redirect to the main domain and I would like the subdomain masked. How do I do this? I tried the wordpress redirection plugin but that didn't work.

http://2014.mydomain.com to go to http://mydomain.com

Also upon redirection I do not want my subdomain name to appear.

Thank you!

Try adding this to the htaccess file in your document root (the one for 2014.mydomain.com). Make sure to add the rules before any wordpress related rules that's already in the htaccess file:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM