URL Rewrite wordpress -
i want rewrite posts url in wordpress using add_rewrite_rule. if query_var action set. example: example.com/my-post-name-slug/?action=query_action
to: example.com/my-post-name-slug/query_action
is possible?
htaccess
# begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /hot/ rewriterule ^ajax/([^/]*)/([^/]*).html$ /hot/wp-admin/admin-ajax.php?action=$1&movie_id=$2 [l] rewritecond %{request_filename} ^\?action\=$ rewritecond ^\?action\= ^/?$ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /hot/index.php [l] </ifmodule> # end wordpress
update: solve
add_rewrite_rule('^slug/([^/]*)/([^/]*)/?','index.php?post_type=tpp&name=$matches[1]&action-query=$matches[2]','top');
you do
rewriteengine on
rewritecond %{request_filename} ^\?action\=$
rewritecond ^\?action\= ^/?$
should work
hope helped mukund2003
Comments
Post a Comment