First-level directory. Htaccess 301 redirect rules

current situation:

set up a website with three domain names, namely a.com, b.com and www.b.com

.

and create a directory called bbs under the root of the website, which is used to install the Discuz system

the structure of the website is as follows:

-/ CMS system is installed

-/ bbs/ DZ system is installed

at the same time, both b.com and www.b.com are redirected to a.com

through .htaccess under the root of the website.

that is, when accessing b.com and www.b.com, both jump to a.com

=

current thoughts:

when I visit b.com/bbs/ or www.b.com/bbs/, I go directly to a.com/bbs/

1. How to write the .htaccess rule?

II. Will .htaccess be placed under the website / root directory or under the first-level directory / bbs/?

ask for God"s guidance, thank you.

Mar.16,2022

after looking for Baidu for a long time, the problem has been solved.

under the / bbs/ directory, add .htaccess and add the following rule:

RewriteCond %{HTTP_HOST} ^b.com [NC]
RewriteRule (.*)$ http://a.com/bbs/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www.b.com [NC]
RewriteRule (.*)$ http://a.com/bbs/$1 [L,R=301]
Menu