I have one domain that used to have its own WP installation, say www.aaa.example
.
Now the content of this has been included in a different domain in a sub-page, say bbb.example/aaa-subpage/
.
Also, the old domain www.aaa.example
has a DNS A
record pointing to the WP Server of bbb.example
.
What I want now is, that all calls go to www.aaa.example/*
should be redirected to bbb.example/aaa-subpage/
no matter which sub-page on aaa.example
was used. So everything should go to one sub-page in the new domain.
I have tried some 301 redirect plugins but so far no chance… all calls from aaa.example
simply go to the top-level page of bbb.example
.
2
Answers
Try this line in the .htaccess:
To redirect requests to
aaa.example/<anything>
tobbb.example/aaa-subpage/
you would need to add the following mod_rewrite directives to the top of the root.htaccess
file. Crucially, it must go before the WordPress front-controller (ie. before the# BEGIN WordPress
comment marker).You do not need to repeat the
RewriteEngine
directive that should already appear later in the file (in the WordPress section).Test first with a 302 (temporary) redirect to avoid caching issues.
You will need to clear your browser cache before testing.