Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is trying to redirect URLs from an old domain where Spanish was the main language to a new domain where English is now the main language. Specifically, they want to redirect URLs from

newdomain/en/portfolio/****

to

newdomain/portfolio/****

using .htaccess.

Solution:
We recommend using a 301 redirect in your .htaccess file to manage the redirection from the old URL structure to the new one. Here are some guides that can help you set up the redirects:

If you're not comfortable with custom coding, you might consider hiring a contractor from our list of recommended professionals at WPML Contractors. Alternatively, you could use an AI tool like ChatGPT to assist you.

If this solution doesn't look relevant to your situation, please feel free to open a new support ticket with us for further assistance.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Alejandro 1 year, 5 months ago.

Assisted by: Alejandro.

Author Posts
November 8, 2023 at 8:17 am #14753459

rodolfoM-5

Tell us what you are trying to do?
Old domain yapa.es was redirect to new domain mario.es
On old domain, main language was spanish. English content was stored inunder
All this content was indexed by google.
On new domain we change main language to english so we are tryng,
all that is going to newdomain/en/portfolio/********, redirect to newdomain/portfolio/****
How can we manage that with htaccess?
On old domain yapa.es we set htaccess this way:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yapa.es$ [OR]
RewriteCond %{HTTP_HOST} ^www.yapa.es$
RewriteRule (.*)$ hidden link [R=301,L]
</IfModule>
Thank you

Is there any documentation that you are following?No

Is there a similar example that we can see?no

What is the link to your site? hidden link

November 9, 2023 at 12:19 pm #14766401

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello!

This is custom coding and it's out of the scope of our support.

I'll try to point you in the right direction here because i know that these types of redirection are sometimes a bit abstract.

You can use a guide like these ones: hidden link

Or follow the inverse of the rule on this link: hidden link which seems to be what you want to achive. as a redirect, in this case you can treat that /en/ as a subfolder/subdirectory. maybe this last link is even better for you: hidden link

In alternative, you can also try to contact one of our contractors (https://wpml.org/contractors/ ) who might know how to fix this for you or use an AI tool like ChatGPT to help you out (this last option would probably help you greatly).

Regards.