Redirection after changing URL structure

#201500
  • Resolved GoGoNano
    Rank Math free

    Hi,

    Question is about redirection after URL structure change. I found some related posts about regex but not that type of example.

    Currently the website is using ?lang parameter for each language. I’m planing to change that into subfolder structure, for example /en, /ru etc. After changing it from WPML, does RM redirects pages automatically or it needs to be done via redirection?

    How would we setup the redirection if old url is with ?lang=ru parameter but new one will be just /ru/?

    Another aspect is that what happens if we want to change default website language from current Estonian into English? This means current sites needs to get /en structure but redirecting pages to /en would lead to conflict between redirections.

    I would appreciate some help in that question.

    Much appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    I’m planing to change that into subfolder structure, for example /en, /ru etc. After changing it from WPML, does RM redirects pages automatically or it needs to be done via redirection?

    You mentioned you are planning to change it to subfolder type with /en or /ru. Are you going to use another plugin to achieve that or you are manually applying that to your site? From your statement, it looks like you’re going to do it manually. Please correct me if I’m wrong.

    Rank Math has a feature to auto-redirect the post only when the slug is changed. Here’s the link for your reference:
    https://rankmath.com/kb/how-to-redirect-posts-after-changing-urls/#num-2-rank-math-auto-post-redirect

    How would we setup the redirection if old url is with ?lang=ru parameter but new one will be just /ru/?

    Unfortunately, the Rank Math Redirection module doesn’t support yet redirecting URLs with query parameters like ?lang=. Our dev team is working on adding this, and hopefully should be added soon. You can use a different plugin to handle that kind of redirection.

    Another aspect is that what happens if we want to change default website language from current Estonian into English? This means current sites needs to get /en structure but redirecting pages to /en would lead to conflict between redirections.

    I’m not quite sure whether I fully understand your concern. But I’ll do my best, and please let me know if I misunderstood.

    Do you mean your current default site is Estonian and wanted it to become English? If so, your main site should be the English version, and the Estonian version of your site will be something like /es.

    I hope that helps.

    Looking forward to helping you.

    Thank you.

    Thank you for quick reply.

    Changing URL structure for languages via WPML, not manually. Now the question stays about redirection. What I wanted to know is if RM makes the redirects automatically if we change settings via WPML or we need to make all redirections ourselves via htaccess or redirection plugin? Htaccess would be the best way because doing all URLs one by one will be painful.

    About the second part, you are correct. Currently, the site is in Estonian which leads to .com domain. It should be in English and Estonian should be moved to /et subfolder. Now the problem is how would I redirect current domain URLs to new Estonian pages when the structure is changed? It would probably great some kind of redirect loop.

    Overall problem is that there are so many redirections that it gets confusing and hard to find best way to do it.

    Hello,

    Thank you for the follow-up.

    Upon testing, changing from ?lang= structure to /language doesn’t create a redirect for your site. In this case, I would recommend redirecting it through .htaccess or a different plugin that can handle this kind of redirect.

    For changing the default language, I would suggest changing it first in WPML before creating the redirect to avoid any redirection loop.

    I hope that clears the confusion.

    Thank you, and looking forward to your update.

    Hi,

    Thank you for reply.

    I’m not fully sure how can I make redirects from main website to /language URL if default language is changed. So if I move every URL without any parameters to /et (stands for Estonian) I will get redirect loop for sure because then I need to redirect /en to default URL. As its already redirected it will redirect to Estonian part again, so it will end of in loop.

    This is very complicated topic, I know that’s why I’m trying to understand best way doing it without harming SEO too much. Its not suggested to change URL structure but this is something that needs to be done to get URLs looking good.

    Looking forward to hear back with your thoughts.

    Hello,

    Thanks for getting back to us.

    Let me start first by saying that our plugin doesn’t support query parameter redirections, so redirecting those pages can’t be done with Rank Math.

    Now, back to your point, have you already installed the new glue plugin from WPML? It’s called WPML SEO and should help solve most of the issues related to SEO and it’s fully compatible with Rank Math.

    Also, if you are changing the URL structure you’ll likely see a drop in rankings even if you 301 redirect all the pages. I also don’t understand how you will get a redirection loop if you redirect all your pages to the correct language.

    As soon as all pages from Estonian are in the et subdomain, you can redirect all the English pages to the en subdomain and so on for all the languages on your website.

    The only way a redirect loop would happen is if you redirect a different language to the main domain from the one set up now, which seems like it’s what you are trying to do.

    Please be aware that changing the default language now is likely to create issues as it’s explained in this thread from WPML: https://wpml.org/forums/topic/how-to-switch-the-default-language/

    Hope this helps clarify some of your points.

    Don’t hesitate to get in touch if you have any other questions.

    Hi Miguel,

    Thank you for giving more details.

    I have not installed WPML SEO but I cannot find any documentation about how it should work with RM. Are there any?

    I’m aware that ranks might drop but I see it as an important step. URLs with ?lang param does not look nice, and I have heard that it’s not good for SEO either. Now I want to get rid of them and change the structure to subfolder-based. I just wanted to make sure that RM is not automatically redirecting any of the pages because I have heard it does. I guess it happens when a single page URL is manually changed?

    So I understood correctly, after changing URL structure, redirections should be made via htaccess to get all links redirected correctly.

    I’m just confused about how this should be done correctly so it would not affect the site too much and all link juice is passed to new URLs.

    About loop. The current default site .com domain is in Estonian. If I change the structure, I want it to be in English. Google has indexed pages on .com domain as Estonian. I’m wondering how would I redirect the main domain to the correct Estonian subfolder without creating a redirect loop.

    As you can see, its confusing me even more. 🙂

    Thank you for the help and support!

    Hello,

    Thanks for getting back to us.

    Unfortunately, we don’t have any specific documentation related to that new plugin but it should install as a simple plug-and-play solution. Here’s the article with more explanations on this plugin: https://wpml.org/compatibility/2021/04/wpml-seo-plugin-better-integration-with-seo-plugins/

    As for your inquiries about the redirections, I believe they are better suited to be asked in the WPML forums since we don’t have control over the redirections that take place when you change the main language of your website using WPML.

    In my previous post, I already included a link to a similar query on the WPML forums and it seems this is not an easy switch but can definitely be made.

    Hope this helps point you in the right direction.

    Don’t hesitate to get in touch if you have any other questions.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘Redirection after changing URL structure’ is closed to new replies.