Redirection with custom rules fails
-
Hi,
I’m getting nuts with Polylang and the rewrite rules. So what’s the problem:
I have a link like http://ssn.localhost/de/skater/name/ and a corresponding rewrite rule:
add_action('generate_rewrite_rules', 'myvar_add_rewrite_rules'); function myvar_add_rewrite_rules($wp_rewrite) { $new_rules = array( 'data/skater/(.+)' => 'index.php?page_id=814&skater='. $wp_rewrite->preg_index(1), '(de|en)/data/skater/(.+)' => 'index.php?page_id=814&skater='.$wp_rewrite->preg_index(2).'&lang='.$wp_rewrite->preg_index(1), ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; }The second rule was nserted after reading Polylang forums. But whatever I do – it doesn’t work.
Usually, (and it worked with qtranslate and WPML) there should be a parameter “skater” as query_var, but I allways get forwarded to 404, or when playing a bit with the rule to http://ssn.localhost/de/skater/.
What is the reason? and how can this be fixed (rewrite analyzer shows the me correct page_id, a skater variable and a lang variable as it should be correct). The rewrite rules were never a problem with other language tools so far.
Please help!!
regards,
LarsP.S.: I tried the latest official version and the latest beta version of PL (1.7.2).
- The language is set from the directory name in pretty permalinks
- Remove /language/ in pretty permalinks
- When the front page is visited, set the language according to the browser preference
The topic ‘Redirection with custom rules fails’ is closed to new replies.