Rewrite rule not matching

I tested the suggestion from my comment and it worked. Remove the brackets from (myaccount) and change $matches[2] in the URL to myaccount: function wpse_287203_rewrite_rule() { add_rewrite_rule( ‘^user/(\d+)/myaccount/?’, ‘index.php?pagename=myaccount&user_id=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpse_287203_rewrite_rule’ ); (myaccount) will not match a whole world. That’s a little more involved. See this Stack Overflow answer for how … Read more

WPML language switcher for custom rewrite rules

A more simple solution for generating the rewrite rules would be to temporarily disable the WPML plugin. I did this using WP-CLI as follows: wp plugin deactivate sitepress-multilingual-cms wp rewrite flush wp plugin activate sitepress-multilingual-cms Note that this only works a single time. Each time you add/modify a category, the rewrite list is flushed and … Read more

subdirectory index.php is not working

All you should need to do is make sure the appropriate DirectoryIndex is set. For example, at the top of your .htaccess file: DirectoryIndex index.php This instructs mod_dir to try to serve index.php when requesting a directory, eg. /sq/first/. If you are requesting URLs/directories that don’t already contain the trailing slash, as in your example: … Read more