Dynamically redirect page based on URL?

Assuming you stick with add_rewrite_rule(), if language and title where set as meta data on the /en/ post, then you can simplify the search down to a simple WP_Meta_Query() for /:lang/:title/ and pull the actually ID of the translated post there. Translations for /en/best-restaurants-in-tokyo: “/it/migliori-ristoranti-a-tokyo” => 4016 “/fr/meilleurs-restaurants-à-tokyo” => 4017

redirect 301 old url to new url

Well, you would have to add some re-write rules in your .htaccess file (unless there’s a plugin that can allow more complex 301 redirect rules). But, in your situation, if I understand correctly, it’s simply not possible to do it in one generic rewrite rule, due to the logic of your new URLs… If all … Read more

Change permalink for default archive – yearly

It should work but note that the date structure contains the structure for year, month and day archives as well, so you’ll need something like: add_action( ‘init’, function() { global $wp_rewrite; $wp_rewrite->date_structure=”archives/%year%/%monthnum%/%day%”; }); Don’t forget to visit your permalinks settings page in wp-admin so that rewrite rules are flushed.

Rewrite rules in multisite

Found the answers: There is nothing to do when using the Rewrite API that isn’t written in the Codex. Rules written using add_rewrite_rule are not added to .htaccess. WP adds them to its database under rewrite_rules in the _options table. It’s important not to forget to: Filter the rewritten permalinks; call the functions on the … Read more

Rewrite URL to remap WordPress Permalink

The most efficient way to accomplish this would be to change the structure to /%postname%/ and add a 301 redirect to your .htaccess file for the old structure: RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ http://example.com/$3 Change example.com to your domain and add the redirect above the # BEGIN WordPress directive so it won’t be removed if WordPress updates … Read more