How should I edit .htaccess file so that my Site is redirected permanently (301) to a subcategory of another website in this way,
Structure:
SiteA.com -----> SiteB.com/category/abc (Rule301) SiteA.com/samplepost ------> SiteB.com/samplepost (Rule 301)
I and new and I need to move a site in such a way that the base URL redirects to a subcategory of another website and all the permalinks redirected to another website as usual structure.
If someone can please make give me custom code for this type of redirection. I couldn't find any thing related to this and I am a beginner.
Thankyou.
Sounds pretty straight forward, you surely could have implemented that yourself:
RewriteEngine on
RewriteRule ^/?$ https://B.example.com/category/abc [R=301,L]
RewriteRule ^ https://B.example.com%{REQUEST_URI} [R=301,L]
If both hosts are served from the same http server you need to be more specific:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^A\.example\.com$
RewriteRule ^/?$ https://B.example.com/category/abc [R=301,L]
RewriteCond %{HTTP_HOST} ^A\.example\.com$
RewriteRule ^ https://B.example.com%{REQUEST_URI} [R=301,L]
You obviously need the rewriting module to be loaded into the http server serving site "A.example.com".
In general it makes sense to implement such rules in the actual http server's host configuration. If you have no access to that you can also use a distributed configuration file for that (".htaccess"), but that comes with a few disadvantages. Above rules will work likewise.