I noticed an issue the other day on a Wordpress server I manage that runs on Ubuntu. We have several virtual directories on that server that use rewrite rules in an htaccess file to present content from a different website. If we use http, it works great! If we use https, we get a page cannot be found error.
What gives?
Well, it turns out that out of the box the /etc/apache2/sites-available/default-ssl has the following setting:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
The above setting makes it so that Apache ignores your htaccess file.
The highlighted items are what we need to change. You need to change AllowOveride None to AllowOveride All (or to whatever you have in your 000-default.conf file). See below:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
After making the change, you need to restart the Apache daemon:
#sudo service apache2 restartOnce Apache restarts, you your rewrite rules should now work over https!