We understand this is annoying. But without advertising-income, we can't keep making this site awesome for you.
Please disable your adblock and script blockers to view this page. Appreciate! 🙏
Home English ArticlesWordPress Best way to redirect WordPress posts to New Domain/Sub Domain

Best way to redirect WordPress posts to New Domain/Sub Domain

by MAL CHIA
Best way to redirect WordPress posts to New Domain/Sub Domain see purpose

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.

export file from WordPress tools

 

2. Extract the url

When you open the xml file, you will see a lot of text here, but we only want the URL.

xml file wordpress

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.

search and replace

 

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.

Replace the link

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).

excel numbers 301 redirect

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

replace to new domainreplace with the close

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.

add 301 redirect in htaccess multisite

 

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.

replace it with google parameters

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.

 

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.

wordpress redirection plugins

 

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.

create csv file for redirection

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.

import csv

 

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. 🙂

301 redirect at once

 

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.

1 comment

Best way to redirect WordPress posts to New Domain/Sub Domain – MaoMaoChia | endcollection February 17, 2020 - 8:42 pm

[…] Source: Best way to redirect WordPress posts to New Domain/Sub Domain – MaoMaoChia […]

Reply

Leave a Comment

You may also like

%d bloggers like this: