Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

This topic contains 14 replies, has 3 voices.

Last updated by Andrey 5 years, 2 months ago.

Assigned support staff: Andrey.

Author Posts
September 14, 2014 at 5:49 pm #470556

jin woo

I am trying to: make rewrite ruled links work with WPML

Hello,

We have some links with rewrite rule and the links are fixed.

the links are for profile pages and front-end forms (just like BUDDYPRESS my profile pages). it looks like these.

hidden link
hidden link
hidden link
hidden link
hidden link
hidden link

and we added rewrite rule for it.

public function jv_rewrite_callback(){
		foreach($this->pages as $page){
			add_rewrite_rule( '^'.$page.'/([^/]*)/?$', 'index.php?pagename='.$page.'&user=$matches[1]', 'top');
			add_rewrite_rule( '^'.$page.'/([^/]*)/page/([^/]*)/?', 'index.php?pagename='.$page.'&user=$matches[1]&paged=$matches[2]', 'top');
			add_rewrite_rule( '([^/]*)/^'.$page.'/([^/]*)/?$', 'index.php?pagename='.$page.'&lang=$matches[1]&user=$matches[2]', 'top');
		};
	}

and the html links ( front-end) looks like this...



	<ul class="nav nav-sidebar">
				<li class="titles"><?php _e('PROFILE', 'jv_fr');?></li>
				<li><a href="""<?php"">user_login);?>"><i class="glyphicon glyphicon-cog"></i> <?php _e('Home', 'jv_fr');?></a></li>
				<li><a href="""<?php"">user_login);?>"><i class="glyphicon glyphicon-cog"></i> <?php _e('Edit My Profile', 'jv_fr');?></a></li>
				<li><a href="""<?php"">user_login);?>"><i class="glyphicon glyphicon-cog"></i> <?php _e('Change Password', 'jv_fr');?></a></li>
			</ul>

We have 2 languages (ex) English, Japanese)

Problems:
1. the links are NOT making to another language links automatically. ex) not like : domain.com/member/username ==> domain.com/jp/member/username

2. tried manually added language link "/language/" but it shows 404 page.
When English is default, Japanese links are showing 404 pages.
When Japanese is default, English links are showing 404 pages.

How can I make it work? We are little bit in a hurry. please give us some tips.

Thank you!!! 🙂

September 15, 2014 at 10:30 am #470982

Ahmed Mohammed
Supporter

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

Thanks for contacting us, I'll help in this.

Your code seems to be good for the first look (there was a previous ticket while there was an extra character 😀 )

So can you please let me check your WPML settings ?

I need to request temporary access (wp-admin and FTP) to your site in order to be of better help.
You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

+ Please make sure that you have a full backup of your website and database. (Please don't ignore this)!
+ It'd be great if you give me an access for a test site where the problem is replicated.

Please tell me where did you place your code, and which pages have the problem.

September 15, 2014 at 1:31 pm #471284

Ahmed Mohammed
Supporter

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

Thanks for the info, I can't login via your FTP details " Error:Failed to retrieve directory listing"
Please check them.

By the way, I could access this hidden link but of course I've set language name as a parameter in Language settings in WPML.

Please let me know if you have fixed FTP details.

September 15, 2014 at 1:36 pm #471291

jin woo

Please try again. I am so sorry.

September 15, 2014 at 2:06 pm #471347

Ahmed Mohammed
Supporter

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

Well, I think I have got it now.

You need to add languages codes for your rewrite rules, please have a look at Andrea reply here, it should help you https://wpml.org/forums/topic/custom-rewrite-rules/#post-148236
and https://wpml.org/forums/topic/custom-rewrite-rules/#post-148668

Please let me know if that helps!

September 15, 2014 at 2:19 pm #471363

jin woo

Hello, yes we added. but it doesn't really work.
I think it's very similar as what we did.
and I am not sure what "ss", "cc" are.

it's /www/wp-content/themes/theme-name/library/dashboard/functions.php

public function jv_rewrite_callback(){
		foreach($this->pages as $page){
			add_rewrite_rule( '^'.$page.'/([^/]*)/?$', 'index.php?pagename='.$page.'&user=$matches[1]', 'top');
			add_rewrite_rule( '^'.$page.'/([^/]*)/page/([^/]*)/?', 'index.php?pagename='.$page.'&user=$matches[1]&paged=$matches[2]', 'top');
			add_rewrite_rule( '([^/]*)/^'.$page.'/([^/]*)/?$', 'index.php?pagename='.$page.'&lang=$matches[1]&user=$matches[2]', 'top');
			add_rewrite_rule( '([^/]+)/([^/]+)/?$', 'index.php?pagename='.$page.'&ss=$matches[1]&cc=$matches[2]&lang=$matches[1]', 'top');
		};
	}

replaced our name.

I am sorry. could you please give me little more tips?

Thank you,

September 15, 2014 at 2:51 pm #471419

Ahmed Mohammed
Supporter

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

mmmm, let me consult with our developers. I'll pass this to them and you should get a reply soon.

Thanks!

September 16, 2014 at 4:52 am #471809

jin woo

Hello Ahmed,

Do you have any news for it? 🙂
I am sorry for being in a hurry.

Thank you,

September 19, 2014 at 11:01 am #475463

jin woo

Hello,

Any news for our issue? a lot of people are asking WPML issues.

Please help us 🙂 and let me know.

Thank you,

September 25, 2014 at 6:47 am #479223

jin woo

Hello I have not heard any news for 10 days 🙂

Should we change re-write rules for WPML?
if you want us to change re-write rules for WPML, can you advice us? any documentary about this?
we can change if it needs to be solved.

please let me know what you think. all settings (ftp, wp admin account) are same for you to enter.

Thank you,
Rob

September 26, 2014 at 9:12 am #480232

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

Sorry for the delay !

WPML hook it's rewrite rules on plugins loaded so you should use your hook on 'init' not 'admin_init'.

Can you confirm if this work for you ?

September 26, 2014 at 9:19 am #480242

jin woo

Yes we have tried both of them 'init' and 'admin_init'.
It doesn't work.

please help me out.

September 26, 2014 at 1:17 pm #480512

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

Let me check this with the development team. I'll keep you posted.

September 26, 2014 at 1:32 pm #480529

jin woo

Yes please.. our buyer so much waiting 🙂

very thank you for your support and time. I was a fan as a user and I am still a fan as an author. (Andrey you help me duplication long time ago 😉 I remember you )
we will also keep trying and leave here any news.

Thank you,
Rob

October 1, 2014 at 8:16 am #483271

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

Sorry for the delay !

Unfortunately, this is something that require a custom work, which is falls outside the scope of our support.

One last advice we may give you is to write a function that hook to option_rewrite_rules, and that function must be hooked to init action, with a low priority (after 10).

In case you need help with custom coding :
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/
http://wpml.org/documentation/support/wpml-contractors/

Thank you for your understanding.

The topic ‘[Closed] links (rewrite) to other languages’ is closed to new replies.