Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
How to 301 Permanent Redirect a Website to a Subcategory of Another Website and Permalinks (Using .htaccess)

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!