Custom rewrite, url path with parameters to a page

Your code seems to work fine with slight modifications. Taken from here: https://developer.wordpress.org/reference/functions/add_rewrite_rule/#comment-content-4787 First off, I moved the rewrite rules to init and modified the regex to match parameters optionally: function wse_414800_rewrite_state_city() { add_rewrite_rule( ‘^(pluginpage)/([^/]*)/([^/]*)/?’, ‘index.php?pagename=pluginpage&state=$matches[2]&city=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘^(pluginpage)/([^/]*)/?’, ‘index.php?pagename=pluginpage&state=$matches[2]’, ‘top’ ); } add_action(‘init’, ‘wse_414800_rewrite_state_city’); And, to be able to retrieve our custom query … Read more

Redirect old homepage to the new one within the same site

Ideally, the blog subdomain would point to a different filesystem location (its own document root), then you could use a simple Redirect directive in its own .htaccess file in the root of the subdomain. For example: Redirect 301 / https://www.example.com/ratgeber/ The Redirect directive is prefix-matching and everything after the match is copied onto the end … Read more