This is not how rewrite_rules works in WordPress.
You miss two things.
- Match. It has
$1, but in reality (take a look to example), you need to work with$matches. - Your Query Var. You using
q, but its not wp native or declared in example code. You can use one of the public ones or declare your query var and logic behind it. - If you are OK with Regular Expressions and already implemnt first two changes, but it still doesn’t work – I would suggest to use debug bar and my plugin debug bar rewrite rules
Related Posts:
- htaccess rewrite conflict with wordpress rules and ssl
- Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache
- WordPress site displaying 404 for any page apart from index
- .htaccess Rewrite URL WordPress
- Redirect main domain to subdirectory
- different child theme for subdomain
- Struggling with add_rewrite_rule
- .htaccess rewrite rule puzzle
- need a help for modify .htaccess rule [closed]
- Best way to redirect site in subdirectory to root?
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- TimThumb & htaccess : clean url
- What to write in the htaccess in order to detect browser language and point accordingly?
- want to rewrite an URL in wordpress
- How to turn this .htaccess rule into a dynamic rule with add_rewrite_rule, et al?
- htaccess problem not being able to overwrite previous rules
- add_rewrite_rule to remove /category/ from permalink
- Relative links stop working after moving wordpress site from hosting to localhost
- htaccess redirect throws an error: PHP Catchable fatal error: Object of class WP_Error could not be converted to string
- Rewrite Rules not redirecting rewrite
- Rewrite URL in address bar for a specific page [closed]
- How do I reset a rewrite?
- Rewriting subfolders to specific parent folder in WordPress
- Redirect default pagination page to template page’s pagination
- Remove subdirectory from links
- How to properly give WordPress its own directory
- Rewrite rules and maintain URL
- Giving WordPress it’s own directory and using .htaccess Directory Index
- rewrite rule on plugin activation
- .htaccess rewrite rule stopped working for wordpress site after moving server
- Best collection of code for your .htaccess file [closed]
- Default .htaccess file for WordPress?
- Which one does WordPress prioritize when it comes to php.ini, wp-config and .htaccess?
- Improve wordpress security by hiding non public resources
- WordPress site hacked. Has .htaccess been hacked?
- Does this .htaccess security setting really work?
- How to add custom rewrite rule to .htaccess?
- htaccess problem after saving Settings
- Stop WordPress and Plugins from Overwriting .htaccess
- File and directory permissions
- htaccess disable WordPress rewrite rules for folder and its contents
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- htaccess https redirect from www to non-www
- Htaccess for Wordpess set on single subdomain
- adding rewrite rules in .htaccess
- .htaccess and 500 error, extra character added
- Wrong canonical link on wp-admin pages
- Name-based virtual host configuration in Apache seems to cause a “500 Internal Server Error”
- Place static HTML files in path below WordPress page
- Site redirects to wrong url when saving settings
- Static raw HTML page
- WordPress + Magento .htaccess ReWriteRule Issue (www vs. non-www)
- Plugin to edit htaccess file
- htaccess rewrite for author query string when WP is in subfolder
- SEO Friendly URLs for my plugin categories
- Why “Settings->Permalinks” creates .htaccess file on nginx server?
- .htaccess for wordpress inside another wordpress install
- .htaccess file redirecting to parent directory
- Blog.php or how to display recent posts?
- Globally force SSL on all pages
- Serve apache 404 for missing assets rather then wp 404 template WP_Rewrites
- Isolating WordPress to a subfolder
- Remove year and month in URL using .htaccess
- index.php not loading in main folder of wordpress
- Custom rewrite rules are sending everything to index.php
- Admin-Ajax.php, SSL, Non-SSL
- How disable SSL redirect for specific URL?
- How to add .htaccess code through a function?
- WordPress keeps writing rewrite rules to .htaccess
- WordPress Rewrite
- Why does the header set X-Robots-Tag apply to all pages?
- Dynamic URL, not a physical page within the database
- Permalinks not working on second wordpress installed in a subdirect
- How to avoid wordpress permalink rules to inherit in a sub-folder
- Error:406 not acceptable
- Unable to access WP admin
- Move wordpress to folder without changing urls
- Rewrite rule not working
- Rewrite rule never matching
- A plugin changes my .htaccess file and I can’t access httpd.conf as that’s a shared server
- Cant block wordpress readme files
- Change wp-content without changing the name of the folder
- 404/500 error on /wp-json
- WordPress keeps deleting .htaccess file
- Cache Busting using htaccess Rewrite rule?
- Correct htaccess to display page while also passing in GET parameters
- What is the role of .htaccess file in WordPress?
- Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021
- Does WP Have a Function To Generate .htaccess RewriteCond?
- Using WordPress only for the backend, and using AngularJS as a frontend
- Temporary .htaccess blocking is disabling WP Crons from running?
- How to restrict access to wp-content, wp-includes and all sub-folders
- Two domains on one WordPress Installation
- .htaccess redirects disappeared after re-saving permalinks
- Protect Upload Folder Files With Ampersand Problem
- How have I misconfigured basic auth for my wordpress site?
- Remove File Extension for Page Outside of WordPress
- Is it possible to dynamically redirect URL using htaccess?
- How can I code my plugin to safely modify .htaccess?
- RedirectMatch and Redirect interfering with each other