Map alt domain to specific section of website w/o MU

I have one website on which I want to use multiple domain names. The URL pattern on the existing looks like this: Main domain: – shop.com – shop.com/products – shop.com/about-us – shop.com/pools/ – shop.com/pools/products – shop.com/pools/about-us – shop.com/spas/ – shop.com/spas/products – shop.com/spas/about-us I’d like to use multiple domain so I could use: Main domain: – … Read more

hard flush_rewrite_rules() not regenerating .htaccess

I am currently developing a theme where I want to add two permalinks. One is redirecting to the index.php with some custom parameters and values (rule stored in the wp_options table), the other is redirecting to a file in my template which offers the admin-ajax.php functionality (rule stored in .htaccess file). add_action( ‘init’, ‘custom_rewrite_rules’ ); … Read more

Can rewrites fallback if 404? Rewrite conflict issue

I have pages and product categories on my site: Pages: –About –Contact Products: –Category 1 —-Subcategory 1 –Category 2 Ideally I want mysite.com/category-1/subcategory-1 to show the product category page and mysite.com/about to show a normal page. I have registered the taxonomy in the following way: function products_taxonomy() { register_taxonomy( ‘product_categories’, ‘product’, array( ‘hierarchical’ => true, … Read more

Remove “/page/1” from the URL

The built-in permalinks in WordPress remove /page/1/ from the url of first page in the archives. However I added following custom rewrite rule add_rewrite_rule(‘xxxx/page/([0-9]{1,})/?$’,’index.php?post_type=xxxx&page=$matches[1]’,’top’); It works fine but it does not remove the “/page/1/”. How can I remove that from the URL with the rewrite rule? 0

How to change the URL pattern for single post view

I have a Custom Post Type registered as “News” And there are 2 taxonomy being assigned to this Custom Post Type i.e News Category, News Country Right now if I am previewing the single news page, the URL pattern it generates is SITE_URL/news/news-title-slug I need a custom URL pattern which follows like this SITE_URL/{term of … Read more

get_query_var with add_rewrite_rule and add_filter(‘query_vars’) not working

I’ve the following code to rewrite url and get the variable add_rewrite_rule(‘galeria-de-honra/([0-9]+)/?$’, ‘index.php?pagename=galeria-de-honra&galeria_year=$matches[1]’, ‘top’); add_filter(‘query_vars’, ‘galeria_de_honra_query_var’); function galeria_de_honra_query_var($query_vars) { $query_vars[] = ‘galeria_year’; return $query_vars; } Where there already is a page with slug ‘galeria-de-honra’, so, after this, in the front end i get the variable using the global $wp global $wp; $year = $wp->query_vars[‘galeria_year’]; if … Read more

Difficulty with rewrite rules

I can’t work out how to combine a rewrite rule and a custom query var. I have created a custom ‘edition’ template, which calls an external API to populate a table with details of a particular book. https://wwww.example.com/books/editions I use a custom query var to populate the database: https://www.example.com/books/editions/?ed=1950 for example, where ed is a … Read more

Plugin action rewrite rule – non_wp_rules

The wp rewrite rule I added to my plugin is not working. Here’s my setup: Scenario I’m trying to get the site’s ads.txt to pull from my plugin’s ads.txt. eg site.com/ads.txt pulls from wp-content/plugins/the-plugin/ads.txt – all done via serverside. Plugin portion add_action( ‘init’, ‘wpse9870_init_external’ ); function wpse9870_init_external() { global $wp_rewrite; $plugin_url = plugins_url( ‘ads.txt’, __FILE__ … Read more