TO get this solution to work. I simply enabled pretty permalinks. Incase you activate permalinks but you are getting server 404 error, this may imply that the .htaccess is not activated on your server. follow the steps below to get this sorted out.
How to Activate an .htaccess file
If you have access to the server settings you can edit the configuration to allow the .htaccess file to override standard website configs. Open the apache2 default host configuration file. NB: You will need sudo privileges for this step.
sudo nano /etc/apache2/sites-available/default
Once inside that file, find the following section, and change the line that says AllowOverride from None to All. The section should now look like this:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
After you save and exit that file, restart apache.
sudo service apache2 restart
Make sure this is included in your .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
You are good to go.
reference:
I use an ubuntu server but this reference was useful for me.