Support » Plugin: Redirection » Wildcard Custom Redirect for Translatepress

  • Resolved MisterH

    (@hmarksthespot)


    Hi, First of all thanks for this great plugin.

    So we are using translate press plugin and have 2 different languages, and we use this plugin as well. And there is a small little challenge here, there are 2 websites that are identical except for the fact one is the main website while the other is a separate setup that is the shop using Woocommerce.

    Now for the website that does not have woo commerce, the menu has a button to the shop.

    Main Website XYZ.com
    Shop XYZ.Com/shop

    The menu on both websites are the same, when someone visits the shop and their language is xyz/shop/fr certain links also act up.

    for example, xyz.com/about can be seen also from xyz.com/de/about which is fine.

    Problem
    If you click on a link from the menu or such FROM the shop (xyz.com/shop/de) then when the link is clicked we will get xyz.com/shop/de/about which does not exist. It should translate to xyz.com/de/about.

    What would be solution to this? Do I need to make a redirect for every single page individually, a custom 302 redirect? or can a wild card be used? If so what should that look like?

    Thanks!

    • This topic was modified 3 months, 2 weeks ago by MisterH.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author John Godley

    (@johnny5)

    The best solution is to fix the menus so they are correct, rather than creating a redirect to work around the problem.

    If you still need a redirect then you can use a regular expression:

    https://redirection.me/support/redirect-regular-expressions/

    Thread Starter MisterH

    (@hmarksthespot)

    Well the menus are working fine as they should with the correct link, the issue is that the translate poress adds a extra suffix to all links and these menus point to an external site, so a normal link that is otherwise xyz.com/about is turned into (xyz.com/shop/de/about which does not exist). We would like to be able to redirect such into xyz.com/de/about.

    Is redirect regular expressions the right way in this case? Can it be made for only selected links or such?

    Plugin Author John Godley

    (@johnny5)

    translate poress adds a extra suffix to all links and these menus point to an external site

    I think it would still be better for your site (performance, SEO) to fix that problem directly. A redirect will be fixing the symptom not the cause.

    A regular expression can match multiple URLs. I don’t know what you mean by ‘selected links’, but it will match whatever URLs you specify in the expression.

    Thread Starter MisterH

    (@hmarksthespot)

    Hi John, Thanks.

    So what I mean is for example, if you kindly go check our page https://removed/ – this is the international version all menus and pages for example about page would be /about-us

    However if you go
    https://removed/de – this is the German version using translate press.

    And then if you go click about, it will automatically take you to https://removed/de/about-us/ – obviously this is the german version of the same page. Thats fantastic.

    Now onto the problem we are trying to resolve, notice the shop: if you go to https://removed/shop/ then all is fine, you can click on the about and all pages in the menu and it will take you to the correct page, (remember its 2 different websites that look identical).

    However if one goes to https://https://removed/shop/de and then they click a menu item about, they are taken to https://removed//de/about which is a page that does not exist and only exists on the main website.

    So that is the problem, would you be able to kindly explain what you mean to fix the problem directly? I dont understand what is the cause?

    By selected links I meant the pages that are only in existence in the main website and such.

    Thank you!

    • This reply was modified 3 months, 2 weeks ago by MisterH.
    Plugin Author John Godley

    (@johnny5)

    I don’t know how your site is setup so I can’t really say what the cause is (and this isn’t the right forum for that kind of question anyway). However, the link on the menu item is pointing to the wrong URL. It seems easier and less problematic to change the link (however it is generated) to point to the correct URL than it is to create redirects.

    Thread Starter MisterH

    (@hmarksthespot)

    I see, Thanks. A question in regards to the links as you mention, those are direct links and are not generated but put there manually (as they are external pages not part of the internal structure of the site). Would you suggest them to be setup differently and could perhaps point me to the right direction? Thank you for your time

    Plugin Author John Godley

    (@johnny5)

    You say the links are manually entered but that would mean you’ve manually entered… the wrong URLs?

    Is it possible you are entering relative URLs and they are being made relative to whatever the page URL is? So when on /de the relative link is /de/about-us but on /de/shop the relative link becomes /de/shop/about-us

    Thread Starter MisterH

    (@hmarksthespot)

    The links are manually entered, they are not wrong, they point and take you to the correct page on the main website.

    The only problem is that translate press is assuming and making the URL’s wrong by adding /DE where it should not.

    Yes you may be right, perhaps I will look int othis relative URL’s subject. I believe translate press is making the URL’s relative based on the page URL. So it goes to add the /de randomly. I wonder what would be the solution to it, should I employ the use of this plugin to resolve it or there is an option somewhere in WP engine..

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.