Use add_rewrite_rule()
.
function wpse325663_rewrite_resource_type() {
add_rewrite_rule('^resources\/(.+)/?', 'resources/?type=$matches[1]', 'top');
}
add_action('init', 'wpse325663_rewrite_resource_type');
An important note from the codex:
Do not forget to flush and regenerate the rewrite rules database after
modifying rules. From WordPress Administration Screens, Select
Settings -> Permalinks and just click Save Changes without any
changes.
Related Posts:
- How to seamlessly redirect between different archive and singular slugs?
- show ALL latest posts with archive.php on example.com/latest
- URL Rewrite and Archive Template Files – Post Type vs. Taxonomy
- Show index and not the archive for “Dog Custom Post” with default slug
- Custom Post type and Custom taxonomy with URL rewrite worked but template did not
- Custom Post Type Settings page, choose page to display archive
- Rewrite Slug for CPT Archive Pages to Plural Name of Slug
- Change author base slug for different roles
- Problem with add_rewrite_rule and pagination (paged and page query_vars)
- Custom Permalinks for Blog Posts Only
- Detect page type by url (Archive, single, page, author,…)
- Using a page template without a page
- Overwrite rewrite-slug of built in post-type ‘post’
- Why does wordpress still strip my query var?
- URL rewrites and pagination
- Rewrite rules goes away
- unexpected problem in url rewrite
- Need to make a php file inside theme accessible via url
- Remove child category from URL
- Rewrite loading custom template file but is_home() returns true, and there’s no 404
- Rewrite rule for admin-ajax.php
- Change WordPress comments url / word
- Rewrite WordPress Custom URL
- WordPress removes spaces in URL on pagination
- Adding more pages to author pages
- How to check current URL for endpoint in a template file?
- add_rewrite_rule not working for language specific characters
- Custom rewrite rule
- Add query string to url and display it as normal url part /folder/
- Is it possible to remove feeds from rewrites?
- WordPress custom post type archive with description
- Flush Rewrite Rules on init or rest_api_init?
- WordPress .htaccess – route other URLs to another app
- Rewrite URL – insert custom variables as a directory path
- URL endpoint with HTML
- Can’t add external rewrites
- CPT Archive with core Category
- Can I have /blog and /foo and /bar all point to the same blog?
- Monkey Man Rewrite Analyzer says my rule will trigger but it doesn’t [closed]
- How do I retain url parameters the entire time a user browses my site?
- Different URL rewrite rules loading the same page
- Cannot access wp-admin without trailing slash – .htaccess configuration for WordPress behind a nginx proxy
- WordPress author url to alias domain url? domain.com/author/{username}/
- Replace specific middle part of url
- Remove Category slug from link
- URL rewriting not working
- Rewriting a subdomain page on one WordPress installation to a parent domain on another
- How to redirect large amount of URLs?
- How to achieve my custom post url structure?
- How to create a front end user profile with a friendly permalink and a 404 trigger
- Rewrite URL for single category
- Help with rewrite rules for two post types
- Understanding the query string after .htaccess rewrite
- How to get default permalink link text?
- Using WP Rewrite to rewrite custom urls in this scenario
- Pass parameters to static home page brings up index.php latest posts
- How to redirect Webp files?
- Create rewrite rule for subpage
- WordPress simple Url Rewrite
- ubuntu + nginx – everything works except “rewrite url structure” [closed]
- Rewriting in wordpress url
- Add pagination to a template loaded by query variable
- Add rel=canonical to only one page
- Why is a rewrite rule in wordpress prevent pagination?
- Using custom url parameters in a page
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- get variable from url?
- Rewrite parameters as Url for SEO
- Home page url rewriting WordPress
- Changing the wordpress default search url to something like – …example.com/search?query=keyword
- Custom post type rewrite with categories and static pages
- Custom folder with PDF files (not in WP Library) – Create url for each file
- WordPress is adding “category” word before my actual category name in url (and this is unsolicited)
- WP returns to domain root instead of siteurl
- Finding the CPT archive template source
- SEF add_rewrite_rule & add_rewrite_tag not working
- Rewrite WordPress Url from root to subfolder without moving files
- Problem building an url with argument
- How do I rewrite URL that has custom parameter
- Change Title Based on Taxonomy Filter in archive-{cpt}.php
- WordPress address url option missing under general setting
- Rewrite rule for post as a child of a CPT
- Which url points to which file
- Post & Page with same slug
- Rewrite CPT permalinks to subdomains
- variable endpoints for webservice
- Make URL like /fr/something display same as /something
- How to retrive previous Domain URL in Wp
- URL Rewrite when WordPress is in subdirectory
- Migration from old CMS to WordPress 301 redirection rules?
- How to change the url?
- Using add_rewrite_tag to create urls for page sections
- How to make wordpress use www.example.com/blog/wp-includes/ instead of www.example.com/wp-includes/?
- Can I exclude a single URL from a rewrite plugin?
- 404 for index.php
- wordpress url rewrite Query Var to Static url
- Add rewrite endpoint and .htaccess
- Remove url parameter using wordpress
- Rewrite rule to simulate page hierarchy results in 404
- add_rewrite_rule not working with custom variables