We are redirecting all traffic on our Magento CE 1.7.0.2 site to HTTPS URL's by default. This is done by setting both the secure and unsecure base URL to https://domain.com.
We also have the "Auto-redirect to Base URL" set to No because having this option enabled (either 301 or 302) resulted in all requests for http://domain.com/product.html redirecting to the homepage (as per the accepted answer here). So we are forced to have the "Auto-redirect to Base URL" option disabled.
However, with the above setup Magento is doing a 302 redirect for all HTTP requests to the equivalent HTTPS URL. This is great for customers as it works seamlessly, but for search engines we would prefer a 301 redirect.
How can we have it do a 301 redirect instead of a 302 given the setup above?