Try to add this one
function add_rewrite_rules() {
$newrules = array('^testrewrite/([0-9]+)/?'=> 'index.php?page_id=$matches[1]');
return $newrules ;
}
add_filter('rewrite_rules_array', 'add_rewrite_rules');
Let me know it is working or not.
Related Posts:
- How to create custom URL routes?
- How to change default page slug?
- Mod_rewrite delete parameter in 301 Redirect
- Need to make a php file inside theme accessible via url
- Evaluating a external rewrite rule before internal wordpress rewrite rule
- Rewrite rule to load images from production does nothing
- Rewrite Rules Are Redirecting and Not Passing VARs
- WordPress rewrite rules don’t need ^?
- WP is ignoring .htaccess rewritten URL
- Rewrite wp-login.php URLS to static pages?
- Rewrite custom post type URL parameters
- Rewrite URLs – Custom Post Type – Post Slug, Taxonamy Slug
- URL Rewriting for PHP script on an image URL
- Change pagination url format
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- Custom Rewrite rule to captured post (rewrite rule to rewrite rule)
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- Localize URL bases
- How can I create custom URL routes?
- How do I make WordPress revise an .htaccess file a certain way?
- How to change an existing wordpress page rewrite rule?
- Pretty URL via Rewrite
- Custom Rewrite for Profiles
- help with rewrite_tag and rewrite_rule for custom page GET variables [duplicate]
- Can’t get pretty permalinks to work without index.php
- Change the “page” slug in pagination
- Understanding add_rewrite_rule
- generate_rewrite_rules (action) vs add_rewrite_rule (function): which one is preferred?
- Rewrite Rules for Multiple (more than 2) Taxonomies
- add_rewrite_rule not loading correct page nor getting variables
- SEO Friendly URLs for my plugin categories
- How do I add a add_rewrite_rule without it redirecting?
- WordPress URL rewrite regex
- Blog installed in subdirectory but need to create pages in root. How to use permalinks?
- WordPress keeps writing rewrite rules to .htaccess
- WordPress Rewrite
- Custom rewrite rule for backend/admin?
- How to have multiple rewrite endpoints in the same URL?
- add_rewrite_rule is not taking effect in WordPress? .htaccess file doesn’t update
- Regionalised Content
- Add specific word to default page permalink
- Plugin action rewrite rule – non_wp_rules
- Map alt domain to specific section of website w/o MU
- Custom query_vars and parse_request on wp-admin
- Have two different URLs show the homepage
- Url Rewriting a dynamic wordpress page
- a one-off rewrite rule
- ReWriteRules and WordPress Multi-Sites with Sub Directories
- Rewrite ugly URL to clean URL
- Rewrite: WordPress URL rewrite on Search
- WPML language switcher for custom rewrite rules
- Taxonomy Pagination Rewrite
- How to write Rewrite rule for same path using Rewrite API?
- Multiple query vars sorting combination and url rewrite
- WordPress keeps writing rewrite rules to .htaccess
- Changing URL scheme, mod_rewrite not helping
- Custom rewrite after the default term link URL
- Requested URL changes when using custom rewrite rule
- How can I reduce the number of rewrite rules?
- Capturing /page-name/[0-99999] in both template and number
- Redirect old query string urls to new SEO urls
- custom wordpress rewrite
- Keep requested/entered url with add_rewrite_rule
- Get wordpress installation folder
- Bilingual WP site: How to achieve different URL sturcture rule based on its language?
- Rewrite author URL to example.com/u/{user_id}/{username}/
- Rewrite Rule for homepage not working correctly
- Adding Rewrite URL for Base + Children Separately
- How to change the displayed URL?
- Rewriting a date hierarchy into a ‘yyyy-mm-dd’ slug
- Why wp redirects me to wp-login.php when I visit a rewritten wp-admin URL?
- add_rewrite_rule() issue with parent/child/child page
- Rewrite only if no other matching page is found
- How can I add a vanity URL for admin-ajax.php Calls?
- Remove part from dynamic url and redirect
- Rewrite rule can’t get the ID from rewrited
- URL rewrite problem in WordPress plugin
- WordPress numeric (yearly) page names / disable yearly archives
- Usw add_rewrite_rule to display frontpage on specific page
- “SAVE PERMALINKS” does more than FLUSH_REWRITE_RULES?
- Rewriting URL with child pages
- Pagination appearing twice in URL after rewrite
- ModRewrite not working properly
- Need help with custom rewrite rule
- Rewrite rules goes away
- WordPress doesn’t remember my custom rewrite rule
- Custom urls in WordPress involving page slugs
- how to change some of the rules in the database
- Rewriting URLs with query strings and preserving them
- get_permalink is getting old rewrite rule
- Rewrite URL based on form input
- What is the proper way to use add_rewrite_rule to remove the (question mark)?
- Custom Rewrite Problem
- WordPress post-type create url rewriting
- Please give me the rewrite rules for my ugly urls
- Use add_rewrite_rule to change subpage url
- Rewrite rule to simulate page hierarchy results in 404
- add_rewrite_rule not working with custom variables
- add_rewrite_rule doesn’t work when trying to add a new parameter at the end of URL
- Standard Regex syntax doesn’t work in WordPress rewrite rule