This question already has an answer here:
How can I get all the year of posts in archive.php and put it on the list?
2016 | 2017 | 2018
And after clicking any year, It will show the posts of the selected year
Do I need to rewrite rules to make this done?