How to Rewrite the URL

WordPress will generate rewrite rules internally once you have selected a permalink format. You can do so under Settings > Permalinks in your WordPress admin area. WordPress will attempt to write to your .htaccess file. If it can’t, it will provide you with some rewrite code you can copy/paste into your .htaccess file.

Either way, WordPress transforms URLs into query arguments. If you want to change the way that WordPress interprets URLs and retrieves data to be displayed, you’ll need to investigate the Rewrite API.