Questions tagged [rewrite-rules]

Rewrite rules modify a web URL's appearance. This modification is called URL rewriting. Rewritten URLs (sometimes known as short, fancy URLs, search engine friendly - SEF URLs, or slugs) are used to provide shorter and more relevant-looking links to web pages. The technique adds a layer of abstraction between the files used to generate a web page and the URL that is presented to the outside world.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

How to solve page not found problem with pagination in wordpress?

I am new in wordpress and i add the rewrite rule for search in twenty-twenty theme, but now the problem is when i go to second page using pagination, it return 404 error. Here is the rewrite rule ...
0
votes
0answers
11 views

rewrite the url keeping the previous one

I would like to understand if it is possible, through add_rewrite_rule, to do this: a user types: https://example.com/username the user sees the page: https://example.com/author/username the url ...
0
votes
0answers
6 views

How to make mydomain.com/[post_typeA]/[post_nameB]/[post_nameA] not 404: custom post types rewrite rules. ([PostTypeA]/[ParentPage]/[ChildPage])

I scoured this forum and a lot of others but I have not found the answer and starting to doubt whether it's even possible.. I'm trying to make a site with week and day posts, a day post is called "...
0
votes
0answers
6 views

Looking to Have Custom Permalink For One Post Category, Removing The Base

I have custom permalinks setup with blogs/%postname%/ for the Press category I need it to just be /%postname%/ I've tried a few post re-writes of permalinks but I couldn't find one that removed the ...
0
votes
1answer
8 views

Rewrite Rule for Post Meta

I would like to create an endpoint for a custom field. For example, I already have a custom 'competition' post type for which rewriting is working great and resolving at website.com/competitions/my-...
0
votes
0answers
11 views

Flush rewrite rules with scheduled event (cron)

I'm trying to flush rewrite rule with a wp_schedule_event function el_custom_cron_schedule( $schedules ) { $schedules['el_every_5mn'] = array( 'interval' => 5*60, 'display' =&...
1
vote
0answers
18 views

want to rewrite an URL in wordpress

i want rewrite some urls in wordpress from http://localhost/wordpress/my-page/2/ to http://localhost/wordpress/my-page/part-2/ anyone can help? Now i am using something like this but it not working....
0
votes
0answers
2 views

Rewrite specific custom post types after blog permalink change

I wanted to make all my blog posts sit under a parent directory of /blog/ in the url's, so /my-great-article becomes /blog/my-great-article. I did this by changing my permalink settings to /blog/%...
0
votes
1answer
10 views

Route subpage to Custom Post Type

I have an artists-single.php page template which shows when I navigate to: /artists/djave_co Is there a way to route /artists/djave_co/anything to the same artists-single.php page? Then I can use ...
1
vote
0answers
13 views

Rewrite rule problem

My permalink is /%category%/%postname%.html But I have to rewrite URL for posts. This is my rule: add_rewrite_rule( '^([a-zA-Z0-9-]+)$', 'index.php?name=$matches[1]', 'bottom' ); But after a ...
0
votes
0answers
9 views

woocommerce product variation permalink

i have some Trouble with my try to develop a solution for my own Online Shop. i can not pay the Plugin what is doing what i need. i try to find a other solution. the beginning is that this code worked ...
0
votes
0answers
6 views

Rewrite URL and Query External API

I'd like to be able to visit a page on my website like website.com/advisor/advisor_id=1234, pass that ID to a function that queries a third party API, return the payload and rewrite my URL as website....
0
votes
0answers
23 views

Archive filter by custom taxonomies

I have a custom post type (product) and a custom taxonomy (platform). I am also using the base category taxonomy to categorize products. I have registered my custom taxonomy as a query_var by using ...
0
votes
0answers
42 views

Mutiple url rewrite rules and get every params

I am creating a messaging system where I have 4 sections (1)inbox (2)sent (3)draft (4)unread so I decide to go with Wordpress add rewrite rules I already add one rewrite rule section. ...
1
vote
1answer
68 views

Rewrite Rules to custom template

At the moment I have the following: a custom template: my_custom_template.php where the function below is called. <?php $uni_data = get_uni_data() ?> a page: www.website.com/my_page which ...
0
votes
1answer
20 views

Custom url for a plugin page add_rewrite_rule Wordpress

I am trying to create a custom url which when hits, loads the plugin file as a template file. On this plugin page i will show progress bar with status of zip being generating. Here is my plugin code....
0
votes
1answer
58 views

Separate posts by chapter per rewrite

I have an unresolved problem, please help me. I use Wordpress. Myurl index.php?story=slug_story&chapter=id_parent-slug_chapter My code add_action( 'init', function () { add_rewrite_rule( ...
0
votes
1answer
24 views

Add custom WordPress admin page with pretty url via code

WordPress add_menu_page and add_submenu_page support adding custom page. The page created have url with a slug similar to wp-admin/admin.php?page=our-custom-page How can create a admin page which ...
1
vote
0answers
33 views

Rewrite Question Mark in Post Template to Make it Pretty URL

I hope you all are doing well and staying safe during these times. I was wondering if someone can help me figure out how to remove the question mark (?) in the URL. The URL I am trying to rewrite ...
0
votes
0answers
21 views

Sudden 404 pages on product category archives

For no apparent reasons, wordpress is returning 404 error on pages that were working fine. Affected pages are product category archive pages. They are a mixture of custom and default pages. The ...
1
vote
1answer
25 views

How to overwrite registered taxonomy url from vendor plugin in child theme

In a vendor plugin I got this : register_taxonomy( 'listing-region', 'listing', array( 'rewrite' => false, 'hierarchical' => true, 'label' => __( 'Regions', 'bt_plugin' ), '...
0
votes
0answers
18 views

Redirect *.php to path using web.config file

I want to redirect blog/customfilename.php to blog/customfilename using web.configfile. I applied this rule: <rule name="hide .php extension" stopProcessing="true"> <match url="(.*)....
0
votes
1answer
36 views

Custom account page that accepts a query parameter

I am trying to add a new account submenu page that takes a query parameter. I have the following which works: add_action('init', function() { add_rewrite_endpoint('scheduled-order-create', ...
0
votes
1answer
39 views

WooCommerce - Conditional for page created by rewrite_rule

I have a page created by a plugin (Dokan) called Products: example.com/dashboard/products The /dashboard/products page is created by a rewrite rule, it's not an actual page which can be seen in the ...
0
votes
1answer
51 views

How to replace custom post type with custom taxonmy in permalinks

I have a Url structure of http://domain.com/hospital/hospitalname (here hospital is custom post type and hospitalname is a registered business user) I want to change the Url structure to http://domain....
0
votes
1answer
18 views

Rewrite Rules are Redirecting

Trying to get a custom rewrite going for a page. Page Slug: /near-me/ Create Redirect: /near-me/STATE/city/ Even after flushing the permalinks. //* Add Rewrite Rule add_action('init', '...
0
votes
0answers
22 views

Add rewrite rules in a loop for custom categories

I am trying to add a new endpoint for my custom category. I have a post like this www.mysite.com/my-post/ and from this site I would like to go the page www.mysite.com/my-post/my-custom-category/. I ...
0
votes
0answers
15 views

Create Seo-Friendly URL using add_rewrite_rule hook

http://builderux.com/neighborhood/detail/4978 this url is working but I want to show the 4978 id's name instead of 4978 id.Look like as below url . http://builderux.com/neighborhood/BORDEAUX Please ...
0
votes
0answers
15 views

Apache errors for blog with separate TLD, in WP multisite which is itself is in a subdirectory

I have a working Wordpress multisite subdirectory installation, which itself resides in a subdirectory on the server, so that the directory structure looks like this: http://domain.tld/ --> some ...
0
votes
1answer
36 views

How to remove parent category from child category url using wordpress rewrite rule?

I am trying to remove parent category from the child category but nothing happens. I have a website made with the use of EDD. currently i have categories like below: angular-templates react-...
1
vote
0answers
18 views

Wordpress Custom URL

i have a self coded plugin with a rewrite rule function custom_rewrite_rule1() { // add_rewrite_rule('^([^/]+)/?','index.php?page_id=$matches[1]&page=$matches[2]&memberID=$matches[3]&...
1
vote
0answers
17 views

How can achieve this permalink perfectly? domain.com/%category%/%post-name%

I want to make a custom post URL like domain.com/%category%/%post-name% and I am able to do it but the problem is, the pages, posts showing 404. I registered a custom post named download with array('...
0
votes
0answers
10 views

Redirect from /sub-directory/old-page to /new-page Wordpress [duplicate]

I have a new website set up (same domain, new server, new Wordpress set up) and one of the old pages has a different url to the new page. The previous set up was: mywebsite.com/sub-directory/old-page ...
0
votes
0answers
27 views

How to structure all custom-taxonomy with three verbs(a,b,c) and route them accordingly?

I have a website structure in which I have created a custom-taxonomy(topic). Whenever a custom-taxonomy-term is created say "1", its three verbs a,b,c are created and they have their templates of ...
0
votes
0answers
32 views

Rewriting a URL to use a custom querystring value

I've added a custom query variable and am attempting to rewrite URLs so that its value is part of the path as opposed to a query-string. For example, given the following URL: example.com/my_post_type/...
0
votes
0answers
15 views

Problems defining a rewrite rule

Using wordpress 5.3.2 and Listify theme, a theme that permits to build business listings using the WP job manager plugin. I have this urls, that works perfectly: https://example.com/index.php?...
0
votes
0answers
29 views

Custom rewrite rules not working with WPML

I have custom rewrite rules for posts on a WordPress website. The website is in french and I just added WPML to make it available also in english. WPML is configured to use directories (/en) for ...
0
votes
1answer
29 views

Order custom post type posts by custom field with pretty URL

I have a custom post type, let's call it my_post_type It has an archive at /my_post_type/ I'd like to create a pretty URL that behaves like the archive page, but orders these posts by a custom field ...
0
votes
1answer
67 views

$wp_rewrite->rules is always NULL

I am trying to learn how WordPress uses the rewrite API to rewrite pretty to ugly URLs . I have some ideas as to how rewrites work in .htaccess file but not how WP handles it . I am reading through ...
0
votes
0answers
9 views

How can I add a vanity URL for admin-ajax.php Calls?

Background I'm using the admin-ajax tool in WordPress to build a file generator. I have everything working, except that the current URL is ugly. I'd like to add a vanity URL that looks cleaner. My ...
0
votes
1answer
63 views

Using a template file for a specific custom URL

I was trying to use a custom URL to load a page template for single-events.php without rewriting the default URL format. I am using filter template_include to load the template like this: add_filter('...
0
votes
1answer
15 views

Remove part from dynamic url and redirect

How do can I redirect the following URL to the next URL? It essentially should remove the ID part (this is a post tag URL). http://wpsoup.test/tag/88/koffie/ -> http://wpsoup.test/tag/koffie/. I've ...
0
votes
0answers
28 views

Rewriting request to another site

I have a multisite WP instance set up to use subdirectories. I have a few pages that should have URLs on each site. The content will be (almost) the same, so I wanted to just make the pages once and ...
0
votes
0answers
42 views

Worpdress Elementor. How to read query variable from rewrote url in?

I need to create a Elementor page which should have the following URL structure: /order/(.*?)-([0-9]+)?$ At this page I should display a Elementor widget which will display information about order ...
0
votes
0answers
16 views

Rewrite rule for wp

I have a URL which i want to change the query string to slug. site.com/shop/?test=new I want to get get the output as ? site.com/new But i don't want to get it redirect to any other page rather ...
0
votes
0answers
27 views

Wordpress Own Rewrite Rules

i am trying to rewrite a URL with the following code in functions.php add_action('init', function() { add_rewrite_rule('/agbz\/(\w*)\/\?page=(\w*)&memberID=([a-z]{1}\d*)&land=(\w*)&...
0
votes
0answers
30 views

Rewrite dynamic URLs as pretty URLs in Wordpress functions.php (add_rewrite_rule) - what's wrong with my code?

I'm using an events calendar plugin to list events on my WordPress site. It uses a custom post type to give each event its own page. There are one-off events and recurring events (eg an event that ...
0
votes
0answers
48 views

The same rewrite slug for multiple taxonomies

I'm using the plugin custom post type ui and I have a custom post type with multiple taxonomies and I'm trying to get my URLs to work. Custom post type → works Taxonomy1 → works_cat Taxonomy2 → ...
0
votes
1answer
21 views

How to get relative page for every post: /post-1/contact. /post-2/contact

Let's say I have a post type called jobs, and a page called contact with a form in it. Now I want the contact page to show on every job url ending with /contact. So job-1/contact, job2/contact etc. I ...
1
vote
0answers
20 views

Rewrite rules automatically for pages using specific template

I'm using rewrite rules to add an optional parameter to a page. This page uses a specific page template which handles the implementation of an external data source. add_rewrite_rule('^page/([0-9]+)/?'...

1
2 3 4 5
21