简体   繁体   中英

redirect subdomain traffic to my main domain

I have migrated my wordpress blog from https://blog.example.com to https://www.example.com/blog and everything is working fine.
Now my main concern is,google have indexed previous urls so how can i redirect my https://blog.example.com/post-name to https://www.example.com/blog/post-name .

redirect the old ULRs archived by google with htaccess and google will know that you made that change.

# This will red`irect a subdomain to the main domain
 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^yoursubdomain\.yourdomain\.com$ [NC]
 RewriteRule ^(.*) http://www.yourdomain.com/$1 [L,R=301]

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