Reputation: 21
Based on the WordPress rewrite rules, I want to change my URLs to user-friendly permalinks. So I used WordPress tips in my functions.php but nothing happened!
I don't know it seems it's because of my link.
Here is my example page who should change the url: [My sample page][2]
Here is my code in functions.php:
function custom_rewrite_basic() {
add_rewrite_rule('^music/([0-9]+)/?', 'index.php?page_id=$matches[1]&cmd=artist', 'top');
}
add_action('init', 'custom_rewrite_basic');
Actually I want to change this url:
page/?cmd=artist
to
/artists
or this url:
page/?cmd=artist_detaile&id=31
to
/dj-taba
So what's my mistake?
Problem solved by myself **
Upvotes: 0
Views: 89
Reputation: 77
Have u enabled use permalinks
option in WP settings? If not do it.
Also u required to turn on rewrite mode on .htaccess file or directly in server conf file.
I hope it gonna help.
Upvotes: 0