Reputation: 435
I am trying to do following rewrite rule on my wordpress page.
I have a page www.mydomain.com/videa
and I want to configure it in the way, when someone types www.mydomain.com/videa/some-string
it will be rewrited (not redirected) to www.mydomain.com/videa/?v=some-string
but the user will still see his URL www.mydomain.com/videa/some-string
.
We are running Nginx server, i tried following rule rewrite "^/videa/(.+)$" "/videa/?v=$1";
but it keeps saying page not found.
Thank you for your help in advance.
Upvotes: 1
Views: 886
Reputation: 754
I believe in this case you are trying to add extra variables to an existing WordPress page, so something like this should work:
function custom_rewrite_basic() {
add_rewrite_rule('^videa/(.+)/?', 'index.php?v=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_basic');
You can put that into your themes functions.php
or create a plugin it. You'll need to flush you rewrite rules by re-saving permalinks in the WordPress admin interface.
Upvotes: 1
Reputation: 333
Try "re-saving" the Permalinks settings from the dashboard after you do the change (/wp-admin/options-permalink.php). Sometimes it fixes the issue.
Upvotes: 0