Any rule that doesn’t point to index.php
is interpreted as an external rule and gets added to .htaccess
.
$matches
array works only when second argument ($redirect
) of add_rewrite_rule() point to file index.php
. External rules need to use the $1
, $2
instead of $matches[1]
, $matches[2]
.
Remember to flush rewrite rules after the change.
Related Posts:
- How to Rewrite WordPress URL for a Plugin
- Rewrite url for existing page without flush_rewrite_rules
- How to change the URL pattern for single post view
- Why doesn’t flush_rewrite_rules run on plugin activation?
- How To Consistently Enforce Rewrite Rule in Plugin Development
- Adding rewrite rule dynamically
- rewrite URL based on selected taxonomy for post page
- add_rewrite_rule behaving strangely
- HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
- configuration of .htaccess for add_rewrite_rule to make sense
- Custom post type change permalink query
- Using meta_key & meta_value in add_rewrite_rule
- Any way to make Apache’s internal redirect work?
- Custom slug in url for CPT and taxonomy
- add_rewrite_rule not working
- How to Rewrite WordPress URL for a Plugin
- Virtual Page with Registration form
- How to Rewrite WordPress URL for a Plugin
- URL rewrite parameter lost (add_rewrite_rule)
- A tool to analyze rewrite rules? [closed]
- Custom pages with plugin
- Making a plugin file accessible via url rewrite?
- Add rewrite rule to permalink structure
- Custom frontend page for plugin without a ‘physical’ page?
- add_rewrite_rule, plugin activation and plugin deactivation
- Custom Rewriting to Plugin with Parameters
- Plugin to Consume a Web Service
- Filter to change the content of 404 page
- Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions
- Removing rules from .htaccess
- Mapping multiple URLs to same page
- External Rewrite Rules
- Rewrite Point Doesn’t Work on Custom Taxonomy
- Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?
- Add_rewrite_rule doesn’t add custom url in plugin
- Does WP Have a Function To Generate .htaccess RewriteCond?
- Custom rewrite rule serves content, but returns 404 error code
- flush_rewrite_rules() not working on plugin activation
- URL rewriting must be activated manually for my plugin
- How to restore WP 5.4 behaviour where a numeric string could added to each page URL and parsed as “page” in WP 5.5?
- Redirect traffic to plugin
- Custom url for a plugin page add_rewrite_rule WordPress
- Append country to ‘pretty’ url but serve same page
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Help With Rewrite_Rules For a Custom Plug-In
- WordPress Custom URL
- Problem with dinamic add_rewrite_rule()
- Remove custom post type slug from URL and add taxonomy Slug
- Help writing custom function with rewrite endpoint that generates a page from dynamic content
- Possible to get all posts with my shortcode?
- Create page (not the post type) dynamically
- How to grab query string from wp-content/uploads/.*
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- Forward an old url rewrite scheme to a new one?
- Plugin architecture to pull from API & create dynamic content on WP site?
- Rewriting Image URLs from dynamic to original
- How to link to custom “archive like” page with custom permalink rules “dynamically”
- Custom Path for a Plugin
- Access to the template file of a plug-in
- Rewrite not working since upgrade to 5.9
- Add variables from rewrite rules to query var
- Change cannonical URL after changing url with add_rewrite_rule()
- WordPress rewrite rule depend on meta values not ids
- WordPress: I wanted to use Add rewrite rule multiple times for multiple CPT in my plugin
- Disabling Yoast, All-in-One, and Rank Math on Certain Pages within a Plugin
- WordPress Own Rewrite Rules
- WordPress custom url without using any of the custom tags given
- How to force download a plugin generated file?
- How to pass a more variable with page/subpage in Wordprees URL?
- Custom pages with plugin
- Rewriting URLs with a query string
- How can I map a specific URL pattern to a plugin for processing
- How can I send an id over the url?
- Apache rewrite rules and wordpress problem
- Mapping multiple URLs to same page
- Use custom clean URLs for a plug in
- How to use permalink query to go to specific tabs in posts
- redirect word-press page with page values
- Custom rewrite, url path with parameters to a page
- Admin config screen without menu
- What is the added “complexity” of custom tables?
- WordPress URL rewrite regex
- Call to undefined function get_blog_option()
- Unable to get content from $post on first publish
- Gutenberg Block add element in the Editor inside InnerBlocks after div – editor-block-list
- WordPress API have Plugin Anti-piracy feature?
- How to display posts in hyperlink with nested slugs?
- Customizer: widget-synced triggers twice
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- Why is the WordPress taxonomy not registering?
- Fatal error: Cannot redeclare admin_notice() [closed]
- Is there any way to hide page from dashboard (all pages list) OR navbar from plugin function?
- Showing results from json-string in WordPress search results page
- Make visible page only in the trash
- Reading plugin settings in esnext wordpress block
- Rewrite rule can’t get the ID from rewrited
- What is the “best” way to update a theme via a plugin?
- Is there a an option to modify the post content directly on the browser instead of having it reflected on browser by modifying in the database?
- Bulk post approval and publishing doesn’t work