There is a custom post type by the name of code parked on a domain: sample.com. The redirect of the whole custom posts of code CPT to the custom posts of code CPT of www.someanotherdomain.com

.htaccess has such a capability?

Can we accomplish this? Is this a WP inbuilt feature?

URL Format:

www.sample.com/code/how-php-works/ for example.

all post of that CPT to:

www.someotherdomain.com/code/how-php-works/ for example.

  • 1
    Please include the URL format you are referring to. (btw .htaccess has 2 cs) – MrWhite Feb 3 at 8:54
  • Includes, the URL format sir. – The WP Intermediate Feb 3 at 9:09
  • You want to redirect this particular post type..Right? – Tejas Gajjar Feb 3 at 9:38
  • Is someotherdomain.com on a different server? – MrWhite Feb 3 at 9:54
  • Yes, on completely different system/server. – The WP Intermediate Feb 3 at 10:18

Try something like the following at the top of your .htaccess file at sample.com:

RewriteEngine On

RewriteRule ^code/. https://www.someotherdomain.com%{REQUEST_URI} [R,L]
| improve this answer | |

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.