You are using the pagename
query var, so, like the name suggests, you are requesting a page with the specified name and not other type of content/post. If you want the rewrite rule works for all types of post (except attachments), you can use the p
query var passing the post_ID
as value. See the available query_vars
in WP core.
Related Posts:
- Rewrite Slug for CPT Archive Pages to Plural Name of Slug
- Change author base slug for different roles
- How to add custom rewrite rule to .htaccess?
- 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,…)
- How to show the same content on multiple URLs?
- Using a page template without a page
- How to seamlessly redirect between different archive and singular slugs?
- Overwrite rewrite-slug of built in post-type ‘post’
- Why does wordpress still strip my query var?
- When to call `add_rewrite_rule` for safety
- URL rewrites and pagination
- Rewrite rules goes away
- Rewrite Rule for Post “Subpage”, with pagination
- unexpected problem in url rewrite
- Need to make a php file inside theme accessible via url
- Rewrite loading custom template file but is_home() returns true, and there’s no 404
- Rewrite rule for admin-ajax.php
- Cache issues with redis and nginx
- 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?
- 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
- How to properly rewrite url by custom var
- Can’t add external rewrites
- How to use URL structure to call PHP code
- 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]
- Append a value to a certain page’s URL before page load
- How do I retain url parameters the entire time a user browses my site?
- Cannot access wp-admin without trailing slash – .htaccess configuration for WordPress behind a nginx proxy
- Wildcard forward all posts and pages with few exceptions
- Help with Rewrite Rule for Custom Post Type with Query String
- Create Dynamic SEO Friendly URL for Virtual Page
- add_rewrite_rule with query variables
- 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
- Pretty URLs and rewrite
- ngnix Url rewrite doesn’t work
- Rewrites rules disappear after a while
- Is it possible to create dynamic endpoint URLs?
- How to get default permalink link text?
- Using WP Rewrite to rewrite custom urls in this scenario
- Localize URL bases
- Pass parameters to static home page brings up index.php latest posts
- How can i ensure that SQL statements are not displayed if an enduser types the wrong variable name in the URL
- How to redirect Webp files?
- Create rewrite rule for subpage
- ubuntu + nginx – everything works except “rewrite url structure” [closed]
- Rewriting in wordpress url
- Proper way to set up rewrite with Wp
- Change /search to /somethingelse
- Why is a rewrite rule in wordpress prevent pagination?
- Using custom url parameters in a page
- Rewrite custom taxonomy slug – but only parent items
- 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
- Rewrite WordPress Url from root to subfolder without moving files
- How to pass username in url
- Problem building an url with argument
- How do I rewrite URL that has custom parameter
- Rewrite rule for post as a child of a CPT
- URL Rewrite and Archive Template Files – Post Type vs. Taxonomy
- Which url points to which file
- Post & Page with same slug
- Need help adding rewrite rules to page
- variable endpoints for webservice
- How to retrive previous Domain URL in Wp
- URL Rewrite when WordPress is in subdirectory
- Rewrite Question
- Change the search URL
- wordpress url rewrite Query Var to Static url
- Add rewrite endpoint and .htaccess
- Remove url parameter using wordpress
- Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
- WP-Include rewrite directory
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?