If your permalinks for wordpress or another CMS are not working on Ubuntu then you will need to follow this guide. To enable mod_rewrite on Ubuntu enter the following command with root permissions.
Enable mod_rewrite Ubuntu
This will enable mod_rewrite for Apache2 on Ubuntu but we need to edit the default Apache2 config to AllowOverrides from .htaccess files or any rewrite rules created by various CMS’s (wordpress, drupal, etc) will be ignored.
Open the following file default apache2 config file on Ubuntu:
(Obviously you can use whatever editor you like, if you need help check out our vi commands cheat sheet.
Look for the following text “AllowOverride None” and change it to “AllowOverride All” ad restart Apache with:
Mod_ReWrite will now be enabled on Ubuntu systems running Apache2.