How to redirect WordPress posts to New Domain/Sub Domain
Are you having problem redirect wordpress post or content to new domain ? Today, Iâm going to share with you how to redirect wordpress posts to new domain the complete operation, Full step. Thereâre many guide out there tell you how to do this, use redirect 301 to tell search engine like google, inform that you have change a new domain, so that wonât affect your SEO effort.
Speed also a factor that will affect your SEO, improve your website speed is very important.
However, is that just simply use 301 redirect all post to new site that all ?
If your website combine couple of language, now you want to separate out each language on subdomain. For example zh.domainname.com for only Chinese article; fr.domainname.com for only French article.
Then you probably struggle because no one sharing how to do this out there.
Before do this I also struggle about it, Iâm worry about once redirect my website will dow or SEO will be affected. I tried to search google and find if someone did it before also share their experience on the internet.
But eventually, I get nothing! All related post are all talks about redirect entire wordpress site, redirect old domain to new domain wordpress, or htaccess redirect to another domain. No one talked about the subdomain, in the end Iâm very frustrated.
I do it myself, I figure out myself. (I know the theory are similar) And finally, Iâve move all my Chinese article from https://maomaochia.com to https://zh.maomaochia.com . Everything looking good, work properly.
So, Iâm here to share this experience, I hope it could help someone who also doing this like me.
Should We do 301Â WordPress redirect Without Plugin ?
If you donât want using any plugins to do 301 redirection, then your another easier choice is add your redirect in .htaccess. Add simple text in htaccess can also do this job, but this is a bit technical stuff. First you need to know what and where to find this file and next is how to write 301 redirection text in the file.
But should you really do proper redirection without using plugins ? From my experience, this is not really a good ideas.
Before this I also think to migrate my site without using plugins, but when I test for this purpose. Many time the url is not really work as what I expect. Itâs not wrong, but it just not work. I donât know why.
I mean when I test for few post for the same way, some post can redirect, some post cannot. So eventually, I give up using without plugins, instead I using a plugins that just easy work for me without any problem.
So if you ask me, I will recommend USE PLUGIN. Itâs FREE.
How to do 301Â WordPress redirect Without Plugin ?
What if you still want to try without plugins ? Okay, I will be here to share with you the exactly way, so you can do a quickly way to do many wordpress post 301 redirect.
Before we start, please backup your site, if anything go wrong you can do recover.
1. Export the file
The very first step is to export the url that you want to migrate or move to another site. You can go to your wordpress [tools], click on [export] and set the post you want to export for 301 redirection.
2. Extract the url
When you open the xml file, you will see a lot of text here, but we only want the URL.
So we can use the search function, Ctrl + f
(windows) or command + f
(Mac). Search for <link>
After that you will get all data that contain the <link>, that is what we want, the url of posts.
3. Replace the link
After we extract the url, the next step is to modify it for htaccess to read it.
For htaccess, it read a site url redirect with this pattern.
{Redirect 301}<space>{"<old url>"}<space>{"<new url>"}
Redirect 301 "/english/earn-free-bitcoin" "/english/how-to-earn-free-bitcoin"
To do that a fast way, we need to make the url with this pattern by using excel can be achieved.
On the step 2, we already get what we want to move. We just need to copy all that link, and paste it in Excel.
Make 2 sheets, sheet 1 and sheet 2 for backup (later need to use). Same using find and replace methods, search for <link>https://maomaochia.com
, replace with Redirect 301"
(I forgot to add the â but actually it will work also).
Next, get another copy from sheet (previous backup) and put it on the sheet we make changed.
Again, search for <link>https://maomaochia.com
, replace with the NEW sub domain/new domain or whatever you want https://zh.maomaochia.com
Last, replace the end </link>
 to space (if you dinât add the â) or replace with "
.
Final, using simple excel or apple numbers app to mix up this two.
For apple Number you can do like this, as long as you choose the column.
= A1&" "&C1
4. Add in htaccess
For multisite, you can do it redirect in Network Admin by copy all url and paste it in the .htaccess file (which Yoast SEO will come with this).
If you cannot find htaccess in wordpress, you can still get it on your hosting file manager, at the domain top root folder or read How to Find Your Siteâs .htaccess File in cPanel.
After, insert all your redirect url, test your website if itâs functional.
How to Tract if People was Redirect to New site from Old site ?
Well, if you using the above methods, to redirect wordpress post quickly way without plugins. Then you might try this.
This work the same theory, by adding few tracking code at the end, so you can track from your google anlaytics.
To do this, continue the previous step until,
Last, replace the end </link> to space (if you dinât add the â) or replace with â.
Here, weâre not going to replace </link>
 to "
, we can replace to analytics tracking url parameters. Replace with it:
?utm_source=oldsite&utm_medium=oldsite
The final step also same, combine the two column and you will get this.
- 3 Easy Way to Add Custom Code, Javascript, Script to WordPress
- How to Switch Sub Site to Primary Site in WordPress Multisite
Use 301 Redirect WordPress Plugin
If you donât want to do so much work and worry about your site crack, I strongly suggest you using plugins. The simple wordpress plugins we use is Redirection. Which have over million of active installed and also which is very great plugin after we tried.
You can redirect WordPress posts to New Domain in a very faster way, and Iâm going to show you how to do now.
1. Active the plugin
The very first step is to get the plugins, itâs free and I think you have done this.
2. Create import file
The best part I think is create the import file. A simple CSV file is done.
The formula is this:
Source | target | regex | type | code | match
At the How to do 301Â WordPress redirect Without Plugin ? we had talk about how to get those link.
Almost the same, using excel or apple numbers to create the table like below.
On the source, put the original url; target put the new domain url; regex = 0; type = url; code = 301 and match = url
3. Import to Redirection
Now, just simply drag the CSV file we have create to Redirection plugins import area or just click add file to add.
4. Done 301 redirect at Once
Now, check on the plugins, you can see the url have been added. You can also try the page, everything will work fine. đ
Final thought
Migrate partially your site is not a very good ideas, if possible, plan properly at the beginning, because it will still affect your SEO little or not. Also, no matter using plugins or without plugins, after migration, you still need to check broken link on your site.
Broken link also can affect your site, and after redirect, broken link might increase due to the internal content linking. So you need to check and test for every page to minimalist the SEO and UX impact.
I hope this experience will help other people who facing the problem same as me. I like to know if this is helpful, please comment below and let me know if this also work for you. Thank you for reading.