0

What I want to do:

  1. Redirect old domain to new domain
  2. Redirect all urls of old domain to new domain's home page (Old and New site serves different contents)

What I've done:

  • 301 redirect old domain to new domain by using

RewriteRule ^(.*)$ http://example.com$1 [R=permanent,L]

  • changed site url and home address of the old domain to new domain

Problems:

  • It only redirects the home address (Old-Example.com) but not the content of the old website.

  • The 404 pages of old website are still reflecting old domain

1 Answer 1

0

Welcome to SO. You're redirecting the users of old website to a new website which will not send the content to the new site. In order to do that what you can do is install a plugin, I usually recommend Updraft plugin to transfer the content of old site to the new site.

This is not only easy to use but also helps in transfering everything including media and database from the site a (old site) to the new site (site b).

Edit: Update your .htaccess to something like this:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]

Hope this answers your question.

6
  • Thanks. I've edited my question to provide more clarity. I'm trying to redirect all urls of old domain to new domain's homepage. I don't want to transfer content of the old site to new site.
    – jollysea
    Jan 15, 2022 at 6:24
  • Edited my question. Please check now. Jan 15, 2022 at 6:28
  • Thanks! I've tried that method before posting here. That works with redirecting oldexample.com to newexample.com. However, it still produces the problems that I have highlighted in my original post. The oldexample.com/wp-admin is not redirected. The content pages of oldexample.com produced 404s.
    – jollysea
    Jan 15, 2022 at 6:59
  • followSymLinks will resolve this issue. and wp-admin will not be redirected to the new domain. What are you actually trying to do? Are you trying to serve new content on new domain or old content on new domain? Jan 15, 2022 at 7:02
  • It doesn't work on my end. It only redirects olddomain.com to newdomain.com. I'd like to redirect all urls of old domain to the home page of new domain. For e.g, olddomain.com to newdomain.com. olddomain.com/123 to newdomain.com, olddomain.com/123/123 to newdomain.com. Is there a way to do it site wide dynamically
    – jollysea
    Jan 15, 2022 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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