I just bought an expired domains and there are lots of backlinks to different subdomains.

I am planning to make a new blog on the domain and I want to get all the link juice.

So I want to create a 301 redirect from subdomains (and their pages) to a page on the root: example.com/MYPAGE

How do I do that in WordPress?

Later Edit:

Someone from Namecheap support helped me, but I'm not sure if this redirect method will get the link juice (backlinks pointing to subdomain).

so what de did:

  1. created the sub.example.com subdomain (where SUB get those backlinks)

  2. created redirect in cPanel from sub.example.com to sub.example.com/^/(.*)$

  3. added this code in .htaccess uploaded on sub.example.com

    RewriteEngine On
    RedirectMatch 301 ^/(.*)$ https://example.com/sub

Is that good enough?

The redirect it works, I have created a page on my wp blog and the traffic from subdomain goes there.

  • What do you mean by #2 ... "created redirect in cPanel from sub.example.com to sub.example.com/^/(.*)$"? You don't need to implement #2 when you are implementing #3. (AFAIK, redirects in cPanel simply edit your .htaccess file for you - often incorrectly.) You should edit your question to include the additional information from your dupe question on StackOverflow.
    – MrWhite
    May 31 at 18:01
  • I have edited. that's what I am asking myself, why do I need #2? so Stephen's code will be enough? Jun 1 at 5:42
  • is there any other code? :( Jun 2 at 1:17

1 Answer 1


Creating 301 redirects to the root directory (home page) will NOT get the link juice from them. Google identifies redirects to the home page as "soft 404" errors and treats them exactly the same as if the page weren't there (actual 404).

If you want to get any link juice, you need to create content that is in some way similar to the original content and redirect to that.

To be able to redirect subdomains you will want to:

  • Create a wild card subdomain in DNS that points to your server
  • Set up a virtual host for it in your web server config, or modify your virtual host for the main domain to accept *.example.com as a server alias.
  • Get a wild card security certificate for your domain to cover all the subdomains

If the links are into the root pages of the sub-domains you will need to add a rewrite rule for each one, either in the virtual host or in the .htaccess. Something like:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub\.example\.com$
RewriteRule ^$ https://www.example.com/sub-replacement-pag [R=301,L]

If the links are all into more specific paths in the subdomains, you can probably make do with using one of the many redirect plugins in WordPress that can help manage them.

However, buying an expired domain for the links isn't a great way to improve your SEO these days. I believe that Google keeps track of when every domain expires and discounts links to that domain that were created before it happens. I wouldn't spend the time and effort that it would take to try it.

  • Thanks, Stephen. I don't want to keep the urls, so can I recreate the subdomains and their pages (that gets backlinks) and then redirect them to root? May 21 at 12:50
  • 4
    Not if you want SEO value from them. May 21 at 15:43
  • can be done without wild cards? i don't know about wild cards and how to use them. May 21 at 18:53
  • Without wildcard you could create each subdomain with a separate DNS record. But if you can create a subdomain DNS record, a wildcard record is just a * in place of the actual name of the subdomain. May 21 at 19:28
  • thanks. other ways without wild cards? :)) May 21 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.