Several reasons can cause this:
- You dont have apache rewrite module installed…. run a2enmod rewrite and restart apache
- You dont have “AllowOverride All” in the apache config file. To fix:
- Find the appropriate section in the apache config (for example, in ubuntu, /etc/apache2/sites-enabled/000-default)
- Find the directory section where wordpress is installed (example: <Directory /var/www/wordpress>
- Ensure the line AllowOverride All is present
- The wordpress folder doesnt have the appropriate permissions… make sure that the webserver user can write to the folder
- You have a wrong .htaccess file.
- Delete the current .htaccess file
- Under Settings > Permalinks, set to default
- Save
- Under Settings > Permalinks, set back to the original value
- Save