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

218
Views
htaccess rewrite to reverse subfolders

As basic as it gets, here is an example of what I'm trying to do: enter image description here

I have a structure that takes different types of CMS' and inside each of those installations, are language variations.

By default the structure looks like this: https://[domain]/[country]/[installation]/[language-code]

Ultimately, I'm trying to get this:

https://[domain]/[country]/[language-code]/[installation]/

I'm wondering if this can be accomplished, due to the fact the folders/languages themselves are not actual folders and in fact rewrites from the CMS' settings (within the subfolders).

As unmodified these would be examples of the current urls:

https://example.com/ca/events/en/
https://example.com/ca/store/en/
https://example.com/ca/network/en/

And example of the desired results:

https://example.com/ca/en/events/
https://example.com/ca/en/store/
https://example.com/ca/en/network/

and for each installation, they dont always have the same languages (eg. ca has en and fr, but us has en and es)

Note: subsequent pages would be appended... eg: https://example.com/ca/en/events/event-name/subpage/

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You may be be able to use this single redirect rule on top of your .htaccess:

RewriteEngine On

RewriteRule ^([a-z]{2})/(.+)/([a-z]{2}/?)$ $1/$3/$2 [L]
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!