Please help. I moved all (1500) posts from one category to a new domain. now I have a lot of 404 errors for posts and images.

Trying to use Redirection, so I'm on the 404 page, bulk edit select all 404s, now can I use this code in Target URL: New domain/(.*) to move them all over to the new domain or will this wreck my website?


1 Answer 1


To redirect all WordPress URLs from a specified category to a new domain, you can use the .htaccess file in your WordPress installation. The .htaccess file is a powerful configuration file used by the Apache web server, and it allows you to set up redirection rules.

Here’s a step-by-step guide to set up this redirection:

Locate Your .htaccess File: The .htaccess file is usually located in the root directory of your WordPress installation. If you can't find it, it might be hidden, or you may need to create one.

Backup .htaccess File: Before making any changes, it's important to back up your current .htaccess file. This way, you can easily revert to the original state if something goes wrong.

Editing .htaccess File: Open your .htaccess file with a text editor. You can do this via an FTP client, or through the file manager in your web hosting control panel.

Add Redirection Rule: You will need to add a rule to redirect URLs from a specific WordPress category. However, .htaccess doesn’t understand WordPress categories directly, so you have to redirect based on the URL structure. Assuming your category URLs follow the standard WordPress format (like http://yourdomain.com/category/your-category/), you can use a rule like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/category/your-category/ [NC]
RewriteRule ^category/your-category/(.*)$ http://newdomain.com/$1 [R=301,L]

Remember to replace 'your_option_name' and 'your_boolean_field' with the actual option name and the key of the boolean field you're trying to modify.

This code snippet should go into your theme's functions.php file or a custom plugin. Be cautious with direct database manipulations; always back up your data before performing operations like these.

Let me know if you need further assistance!

  • as the images are not identified by categories, will they also be redirected to their respective files on the new domain for that category?
    – Will Sher
    Jan 23 at 0:52
  • Give me some sample urls Jan 23 at 15:49

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.