How to exclude a directory from WordPress permalinks in a Multisite environment?

This “exception” would only be required if you are requesting virtual URLs within /folderToExclude, as opposed to physical files. Any requests to physical directories and files are naturally excluded by the standard WordPress directives. RewriteCond %{REQUEST_URI} !^/(folderToExclude/.*)$ # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp-admin/ [R=301,L] This condition (RewriteCond directive) won’t do anything … Read more

Customising rewrite rules for CPT single post URL to work as paged URL

Ok, so I got it working more or less correctly, although there is still a small problem left, please read on.. Here is what I’ve got: in fucntions.php: Rewrite rules add_action(‘init’, ‘my_rewrite_add_rewrites’); function my_rewrite_add_rewrites(){ add_rewrite_rule( ‘^services/([^/]+)/?$’, ‘index.php?post_type=service&order=ASC&orderby=menu_order’, ‘top’ ); add_rewrite_rule( ‘^services/([^/]+)/page/?([0-9]{1,})/?$’, ‘index.php?post_type=service&paged=$matches[2]&order=ASC&orderby=menu_order’, ‘top’ ); } Redirect rule add_action(“template_redirect”, ‘my_template_redirect’); function my_template_redirect(){ global $wp_query; // if … Read more

URL Rewrite doesn’t work for nested pages

I have found my answer while searching. Thanks to this answer of @Milo: https://wordpress.stackexchange.com/a/50775/23214 pagename must include the full parent/child path. So, I had to change index.php?pagename=page-b… to index.php?pagename=page-a/page-b…. Changed it and works ok. Here is the Full code: add_filter( ‘query_vars’, ‘wpse26388_query_vars’ ); function wpse26388_query_vars( $query_vars ){ $query_vars[] = ‘var1’; $query_vars[] = ‘var2’; $query_vars[] = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)