Please try this.
First add the rewrite rule you need with this function
add_action( 'init', 'rewrite_site_tools_page' );
function rewrite_site_tools_page() {
add_rewrite_rule(
'^site-tools-([^/]+)$',
'index.php?pagename=site-tools&tool=$matches[1]',
'top');
}
Assuming that page name is site-tools.
Now add the tool as query var
add_filter('query_vars', 'wpd_query_vars');
function wpd_query_vars( $query_vars ){
$query_vars[] = 'tool';
return $query_vars;
}
Save permalinks.
Now if you access hxxp://yourdomain.com/site-tools-calculator/ It should work (calculator can be anything else )
If you want to debug it, you can dump the query var “tool” by this function:
add_action('template_redirect', 'test_my_queryvar', 999 );
function test_my_queryvar() {
die( var_dump( get_query_var( 'tool' ) ) );
}
Related Posts:
- Permalinks: Page Not Found
- Custom Permalink
- How do I add /blog/ as a prefix to permalink structure for posts, categories & tags?
- Redirect Uploads Folder to Query Vars in WordPress
- .htaccess to redirect to a wp page
- No Ones Been Able to Override my WordPress Rewrite Rule Issue!
- Standard Htaccess directives disappear by themselves
- Move WordPress to subdirectory, keep ALL URLs
- Regex in add_rewrite_tag not accepting OR operators?
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- How do I turn off 301 redirecting posts (not canonical)?
- Permalink/Pagination issue: Category base name same as page name
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]
- add_rewrite_rule with 3 or fewer matches?
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- How to change URL structure for pagination pages?
- custom naming of search permalink /search/
- Rewriting search permalink
- Using WP rather than .htaccess to redirect pages/posts
- rewrite_rule for custom post type doesn’t affect get_permalink
- Add ‘articles’ prefix before blog posts url without affecting pagination
- What happens when permalink settings are updated?
- custom permalink/shortlink with base62 encoded post ID
- How can I make my .htaccess file writeable by wp-admin?
- query_vars in plugin not working?
- WordPress not respecting template hierarchy (fetches index.php instead of single.php or page.php)
- Call to a member function add_rule() on a non-object
- Why does chrome keep downloading a file instead of running the site?
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Re-write specific custom post type category URL to go to another page
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- WordPress 404 in development area
- Rewrite Rule for default post type
- Custom query var rewriting with only variable
- Date Archives’ Permalinks under Category folder
- Change in permalink structure made javascript cookie not work correctly
- add_rewrite_rule not working for me
- Using WP Rewrite, but just not “getting it”
- Share same Slug for a Custom Post Type and 2 Taxonomies
- Rewrite CPT permalinks and include WPML language
- Redirect a Blogger Page URL to wordpress
- Need To Add Custom rewrite base url for individual user
- Htaccess https 301 problem
- An other permalink problem – 404 Error
- WordPress Not Using Template Files After Permalink Update
- Permalinks only for posts
- rewrite rule to redirect to the most recent date permalink
- How to prevent WP overwriting my custom htaccess rewrites?
- mod-rewrite exception? keep #hash in matching urls?
- .htaccess rewriterule being ignored – tyring to remove dates from WP posts
- Permalink for specific page name
- Permalink for PDF of article
- Comment author url link is wrong? How to change from authors/ to author/
- How to redirect RSS feeds to Feedburner and keep pretty permalinks?
- Adding URL prefix for foreign language support
- WordPress not generating .htaccess but tells me that (Permalink structure updated.)
- Ignore postname in permalink
- Permalinks – .htaccess
- Custom permalink structure with %postname% in front of domain name
- Configuring Home Page Address
- How can I set up a secondary permalink structure?
- permalink and add_rewrite_rule – error 404
- old permalinks not found
- mod-rewrite rules grabs “broken permalinks”, too
- How to Use metada Value in Url and is it possible? [duplicate]
- Safest way to create a custom permalink
- Rewrite Post URL so it is constructed from parent post url & child post url
- Create different permalinks for same post
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Redirect page to homepage, keeping URL
- Added a prefix in URL permalink structure but the old structure still working!
- how to have same rewrite rules for 2 different post type?
- Permalink structure /page/page/cpt-post gives 404 with pagination
- Custom Permlinks work, regular page permalinks don’t
- What permastrusture tags are generated out of the box right after creating custom post types and taxonomies?
- Rewrite posts url as they’re all children of a page
- Issue with my links or permalinks
- Multiple Permalink Patterns for one page
- create user’s view profile link with username
- How to rewrite a folder in WordPress?
- Where is wordpress redirecting wp-admin/admin/dashboard to wp-admin and how to turn it off
- Added incorrect rewrite rule now getting an error
- Why doesn’t WP update my .htaccess file?
- WordPress permalink still not working (error or not understood?)
- Only homepage working correctly, 404 error on everything else
- customize urls displayed by previous_post_link and next_post_link
- Removed and Reinstalled WordPress, Redirect Broken now
- .htaccess not working in WordPress
- Problem when i configure permalink
- custom permlink .htaccess file 404 Not Found error
- Why are all pages redirecting to homepage when using custom permalinks?
- Files placed in directory with wordpress 404
- 404 not found error on WordPress local host
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- Add segment to URL in htaccess
- htaccess strip url
- Add additional URL variations for a Post
- How to use ‘blogs.dir’ as media upload instead of ‘uploads’ directory in WordPress multisite setup