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 3 replies, has 2 voices.

Last updated by Raja Mohammed 5 months, 3 weeks ago.

Assigned support staff: Raja Mohammed.

Author Posts
April 14, 2019 at 7:59 pm #3608617

nomad-cphA

Hey there,

Our site, nomadcph.com is in two languages, english is the primary and danish is the secondary. When I set up the site I used defaults for the danish version URLs: ?lang=da and for SEO reasons I want to change it to /da/ I made the change and am successfully testing this now.

I referenced this ticket to help me with the redirects through the website: https://wpml.org/forums/topic/need-help-with-htaccess-redirect-after-changing-language-url-format/

and added this to my htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} lang=da
# exclude all requests starting with /wp-admin/
RewriteCond %{REQUEST_URI} !^/wp-admin/.*$
RewriteRule ^(.*) /da/$1? [L,R=301]
</IfModule>

However I noticed that if I use an old danish link, hidden link for example... it takes you to the version in english for the product. I expected the redirect to take it to hidden link

The main website link works fine: if i go to old hidden link the redirect works fine, it just when the links get longer that it has the redirect issue.

Do you have any insight on how I can get the redirects to work throughout the whole site? I am going to change it back to the ?lang=da for now until I hear back from you (and also removed those lines from the htaccess file.)

Thanks for your help!

April 15, 2019 at 10:09 am #3612275

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi there,

Welcome to our forum,

Whenever you change the URL format you should also resave the permalinks and flush all the cache types, has this been done already? Please also confirm whether you are using the directory URL for default language?

Please let me know the result. if the issue persists provide me temporary access to your site I have enabled private fields for you to securely share the details,

It would be good if you can provide me with the WordPress debug.log (not WPML debug information).

To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );

In this case, the errors will be saved to a debug.log log file inside the /wp-content/ directory.

If you can paste your debug.log to pastebin.com and provide me that link it would be great! (This is the cleanest way because sometimes the logs are long and create a complete mess in the discussion).

Kind regards
Raja

April 23, 2019 at 3:48 pm #3665825

nomad-cphA

Raja,

Thanks for your help, I appreciate your time: Sorry it has taken me a bit to get back to you. I am worried about making these changes myself (and how they could affect links ,SEO and usabiltiy of the page after it has already launched and is live) and would like to see if maybe you can recommened a developer to help us with this, or if you yourself can help for compensation. Please let me know, thanks so much,

Jeff

April 24, 2019 at 11:29 am #3672139

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi there,

I have checked the issue with my team, The code you have in your .htaccess should solve your issue. However, it seems you are still using the lang param as your URL can you please confirm the same? Regarding SEO If you have a permanent redirect then it won't have any serious issues.

This is beyond our support capability and since you have requested for recommended developers please refer to our list of contractors https://wpml.org/documentation/about-wpml-contractors/contractors-certification/ who can add some custom coding which is beyond the scope of WPML plugin or not available in the core functionality.

Kind regards
Raja