Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8833037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:40:55+00:00 2026-06-14T08:40:55+00:00

I need to redirect the following URL which has the country code at the

  • 0

I need to redirect the following URL which has the country code at the start:

http://xx.domain.com/test.html

into:

http://xx.domain.com/xx_en/test.html

I came up with the following, of course this will have an infinite loop:

RewriteCond %{REQUEST_URI} !/xx_en/ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com [NC]
RewriteRule (.*) /%1_en/$1 [R=301,L]

So I added the first line which, I think, means if you don’t see /xx_en/ in the request_uri then do what follows.

Any idea what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:40:56+00:00Added an answer on June 14, 2026 at 8:40 am

    Use something like the following set of rules:

    RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/%1_en/.*$
    RewriteRule ^(.*)$ /%1_en/$1 [R=301,L]
    

    You can understand it like: for all requests to all 3rd level domains under domain.com which doesn’t start with /<3rd level>_en/ redirect to it…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help to redirect the following URL (in htaccess) http:www.domain.com/article/the-bp-oil-spill-one-year-later/19918396/20110420/ To http:www.domain.com/article/the-bp-oil-spill-one-year-later/19918396/2011/04/20/ my
I need a .htaccess configuration that does the following: Redirect www.domain.com to domain.com Redirect
I have the following code: Redirect /email http://email.secureserver.net Which doesn't seem to be working.
I'm struggling with a redirect problem. I need to redirect the following URL with
I have the following htaccess to redirect users from www.mysite.com or http://mysite.com to http://mysite.com/subfolder
I have paginated URLs that look like http://www.domain.com/tag/apple/page/1/ If a URL such as http://www.domain.com/tag/apple/page/*2/
I need to redirect users to the Change Password page if their password has
I need to redirect the user to page not found page if the url
I have the following situation with url rewrite rules which are getting conflicted with
I need to pass additional parameter to redirect url when the user accept fb

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.