0

I am using two domains for a blog, being exact:

  1. prsblog.com
  2. pyarb.com

Previously, prsblog.com is acting like blog and definitely on WordPress. Few months ago, I migrated the blog content to pyarb.com. At that time, I was using .htaccess for 301 redirection of all posts using Wildcard redirection.

Now, I installed a WordPress MultiSite on prsblog.com and configured few more sites. Problem arises when my existing posts and links (around 3000 including posts/images/products and custom posts) which are on social network and search listings, need to be redirected to same page at new domain.

But, I can't use wildcard redirection because, I have few pages on prsblo.com (WPMU) and need to use its Admin Dashboard for adding sites frequently.

Can you please suggest me workground for redirecting only posts and other media links excluding wp-admin.

Please don't tell me to use Redirection plugin, it will take hefty of time and will be problematic too. Thanks in advance.

  • If there is nothing that differentiates these 3000 old URLs and you are unable to redirect these 1 by 1 (if you had a log of all these URLs then you could construct a RewriteMap - if you have access to the server config), then the only option is to redirect all requests that trigger a 404 on the new WP MultiSite. The problem then is that the new site will never generate a 404 of its own. – MrWhite Aug 16 '17 at 13:46
1

Thanks everyone for taking time to look and get it solved. After so many trials and try-catch, I managed to achieve the above task by adding these lines to .htaccess

RewriteCond %{HTTP_HOST} ^(www\.)?prsblog\.com$ [NC]
#RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif|ico)$ [NC]
RewriteCond %{REQUEST_URI} !wp-admin
RewriteRule ^(.*)$ https://www.pyarb.com/$1 [L,R=301]

This solved my problem for instant.

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.