I have a domain with four websites to close shortly:
- www.example.com (main site)
- www.example.com/site2
- www.example.com/site3
- www.example.com/site4
the .htaccess file of the main site, contains the following code:
Redirect 301 / https://www.mynewsite.com
In this way, if the user visits the site www.example.com/site1, he is redirected to www.mynewsite.com/site1 which does not exist and therefore the page returns a 404 error. This applies to all pages and folders of the site to be closed.
Although it is not a good practice, I would like to redirect any page and folder of all websites to be closed, to the homepage of the new site, except for the site www.example.com/site4 which must still be open to the public.
How is this accomplished? Do I have to work exclusively with the .htaccess file on the main site?