WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multisite multilingue redirection after migration (6 posts)

  1. JpFayolle
    Member
    Posted 1 year ago #

    Hello,

    My current installation is 3lingual with url like: http://www.example.com/category/postname/ for the english posts and
    http://www.example.com/category/postname/?lang=fr or ?lang=es for the french or spanish posts.

    I have installed a multisite with 3 sites /fr/, /en/, /es/ and migrated all the previous posts to this new installation with urls like
    http://www.example.com/fr/postname or http://www.example.com/en/postname (without the category).

    I was looking to redirect all the posts to the new installation thru .htaccess but I am not sure this is possible because the previous english posts do not use the ?lang parameter.

    So, to make it clear can I redirect:
    http://www.example.com/category/postname/?lang=fr to
    http://www.example.com/fr/postname ?

    and http://www.example.com/category/postname to http://www.example.com/en/postname ?

    Or should I use a redirection plugin ?

  2. Hm. That's tricky. I think you may be able to do this via .htaccess.

    RewriteRule ^/category/(.+)\?lang=fr$ /fr/$1/ [L,R]
    RewriteRule ^/category/(.+)\?lang=es$ /es/$1/ [L,R]
    RewriteRule ^/category/(.*)$ /en/$1/ [L,R]

    As long as you keep the /en/ one at the end, that should sort through the other languages, and kick the last one to English.

  3. JpFayolle
    Member
    Posted 1 year ago #

    Thanks Mika,

    I could not make it work (maybe I did not put it at the right place in the htaccess file) but I did not insist too much as, testing it, I discovered that too much of my posts' names have changed, so I will definitively need a redirection plugin.

    Thanks again,
    Regards,
    Jean-Pierre

  4. JpFayolle
    Member
    Posted 1 year ago #

    I have now moved to the multisite installation (see http://www.qualilogy.com, see http://www.qualilogy.com/fr/, ../en/, ../es/) but I cannot get any redirection working.

    I have been doing the following tests, unsuccessfully:

    In .htaccess:
    Redirect 301 http://qualilogy.com/application-quality/the-3-costs/?lang=es http://qualilogy.com/es/los-3-costes

    Redirect 301 /application-quality/the-3-costs/?lang=es http://qualilogy.com/es/los-3-costes

    Redirect 301 Redirect 301 /?lang=es http://qualilogy.com/es/

    Creating an /application-quality/ folder with its own htaccess. with
    Redirect 301 /the-3-costs/?lang=es http://qualilogy.com/es/los-3-costes

    All these instructions on first line of the htaccess file.
    Nothing works.

    I will continue investigating. Maybe the rewrite instructions ?
    Do not hesitate to ask for any precision.
    Regards,
    Jean-Pierre

  5. JpFayolle
    Member
    Posted 1 year ago #

    Allright,

    The problem comes from the /?lang parameter.
    I did try
    Redirect 301 /application-quality/the-3-costs/ http://qualilogy.com/en/the-3-costs/
    and it comes to:
    http://qualilogy.com/en/the-3-costs/?lang=es

    So I can redirect any page (fr, en, es) to the english one (en) but not to the one specific to the language.

    What should I do so that the parameter is taken in account?
    Redirectmatch?

    Do not hesitate to ask for any precision,
    Regards,
    Jean-Pierre

  6. JpFayolle
    Member
    Posted 1 year ago #

    Topic closed.

Topic Closed

This topic has been closed to new replies.

About this Topic