In case you run into problem with your wordpress installation especially when you change your permalinks and start getting 404 errors, it may be due to the apache config not properly enabled.
When you change the permalinks in the Wordpress backend, you may land up with the following error.
You need to edit your apache config and change it as follows
sudo vim /etc/apache2/apache2.conf
Find the code which deals with the folders of your wordpress installation. There you will have to change the
AllowOverride None to
<Directory var/www/> FollowSymLinks AllowOverride All </Directory>