I had a similar problem when setting up on my VPS (Ubuntu 14.04 64-bit). Apache rewrite wasn’t working despite mod_rewrite being active and turned on via the .htaccess file. However, the .htacces file was being ingnored. I was getting 404s whenever the URL wouldn’t correspond to an actual file.
I found out that my problem was my default Apache Virtual Hosts file located at /etc/apache2/sites-available/000-default.conf
. It read:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorDocument 404 /index.html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Turns out, this config file wasn’t allowing .htaccess to override default/server wide Apache settings, like mod_rewrite being off by default. I ended up adding the appropriate directives to allow .htaccess to override the settings. This is what my default vhost conf ended up looking like.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory "/var/www/html">
AllowOverride All
Require all granted
</Directory>
ErrorDocument 404 /index.html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
This fixed my problem. I don’t know if this is your case as well, but it wouldn’t hurt to check. Hope it helps! Depending on your OS and web stack, the location of these files might vary.