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 7433001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:32:48+00:00 2026-05-29T09:32:48+00:00

I am running a WP Blog with qtranslate. It allows me to create posts

  • 0

I am running a WP Blog with qtranslate. It allows me to create posts in multiple languages.

1 . Example URL without qtranslate:

  • http://www.mysite.com/post1

2 . Example URL with localized content:

  • http://www.mysite.com/**en**/post1 (english – my default and fallback)

  • http://www.mysite.com/**de**/post1

Unfortunately search engines etc. still remember my old links (1.) and these are still access-able. So "www.mysite.com/post1" now shows my english content without a redirect. But what it should do is to 301 users to "www.mysite.com/en/post1".

So now I would need a rule that basically checks if there is /en/post1 or a /de/post1 in the URL and otherwise redirect to the fallback /en/post1 URL. There is one exception because "/shop" is a real subdirectory and does not need to be preceeded by language information.

— UPDATE —

I did it!!! That was actually fun but took me quite a while to figure out.

RewriteRule ^$ en [R=301,L]
RewriteRule ^([a-z]{2})/{1}$ $1 [R=301,L]
RewriteRule ^([a-zA-Z0-9\-\_]{3,})(/|$)$ en/$1 [R=301,L]

There are probably better ways to do this but it does the trick. Thanks everyone for the initial help!

  • 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-05-29T09:32:49+00:00Added an answer on May 29, 2026 at 9:32 am

    Have you tried using a universal RewriteRule, and using RewriteConds to eliminate the cases that you don’t want it to rewrite?

    It would go something like:

    RewriteCond %{REQUEST_URI} !^/shop(/|$)
    RewriteCond %{REQUEST_URI} !^/(en|de)(/|$)
    RewriteRule ^(.*)$ /en/$1 [R=301]
    

    But as per Camilo’s suggestion, you could change that middle line to

    RewriteCond %{REQUEST_URI} !^/[a-z]{2}(/|$)
    

    as long as you can ensure that your post permalinks won’t be less than three characters (I’m not familiar enough with WordPress to be sure if that’s possible).

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

Sidebar

Related Questions

I've followed the instructions from http://www.lucidimagination.com/blog/2009/03/09/nutch-solr/ Had solr up and running before that, could
When running the MVC 2 Areas example that has a Blog Area and Blog
I have been running this code (from: http://blog.somethingaboutcode.com/?p=155 ): from twisted.internet import reactor from
Recently I was running the example provided by Andrew Hunter on his blog The
I just followed the instructions from this page ( http://www.alexkorn.com/blog/2011/03/getting-php-mysql-running-amazon-ec2/ ) to setup apache
I am running a blog at posterous.com, and they can host my domain name
I am running an ASP.NET WebForms blog engine web site at maxpavlov.com I am
Here is the Github link: http://github.com/ryanb/railscasts-episodes/tree/master/episode-170/blog/app Running: git clone http://github.com/ryanb/railscasts-episodes.git Gave me an empty
I'm running a wordpress blog and would like to access the actual file that
We've got a webserver running IIS. We'd like to run maybe a shared blog

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.