WordPress URL rewriting; How to match URL parameters
I have URL: https://www.example.com/articles?page=2. I need to rewrite it to WordPress format: https://www.example.com/index.php?category_name=articles&paged=2. I tried with rewrite rule like this: add_rewrite_rule('^(.+?)\?page=([0-9]+)$', 'index.php?category_name=$matches[1]&paged=$matches[2]', 'top'); However this does not work. I have legacy CMS that I try to migrate to WP and I need to keep old URL structure. Suggestions?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.