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

366
Views
Redirect multiple subfolders/subdirectory to one domain

So I would like to know if it is possible to redirect multiple subdirectories to another domain using htaccess.

Current situation:

  • example.de/de/
  • example.de/nl/
  • example.de/fr/
  • example.de/en/
  • example.de/it/
  • example.de/es/

Ideally with redirects:

  • example.de/de/ --> stays on example.de/de/
  • example.de/nl/ --> example2.com/nl/
  • example.de/fr/ --> example2.com/fr/
  • example.de/en/ --> example2.com/en/
  • example.de/it/ --> example2.com/it/
  • example.de/es/ --> example2.com/es/

I read a little about Apache and its syntax, but I am still far from understanding it entirely. It seems to use regular expressions, but does not use '|' (or).

The website host instructs to write the htaccess as follows, where example.nl/webshop redirects to example.com/shop:

Redirect 301 /webshop http://www.example.com/shop

But I need it to redirect multiple, but not all, subdirectories. Is it possible using regular expressions and if so, how? If not possible to redirect multiple subdirectories, what are the alternatives?

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use mod-rewrite to redirect your URLs . Try the following in your htaccess file :

RewriteEngine on

#redirect the specified lang paths to another domain
RewriteRule ^(nl|fr|en|it|es)/ https://example2.com%{REQUEST_URI} [NE,L,R=301]
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!