I know this has been covered everywhere, and I've actually made this work on another server, but I can't seem to get it to work.
I have this
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
currently in /etc/apache2/conf.d/site.conf
. No go.
I also tried it in /var/www/.htaccess
. No go. I couldn't even get an improperly formatted /var/www/.htaccess
to cause 500 error. (Does a setting have to be changed to use .htaccess
?)
I am not using a domain name, and I'm using a2ensite default-ssl
.
SPDY & FastCGI
I don't know if this matters, but I installed SPDY per these instructions http://www.howtoforge.com/using-mod_spdy-with-apache2-on-ubuntu-12.10 and FastCGI by apt-get install libapache2-mod-fastcgi
, a2enmod actions fastcgi alias
, and services apache2 restart
.
Redirect
directive in the non-SSLVirtualHost
block? mod_rewrite seems overkill for this, I think.sudo a2enmod rewrite
to enable.Redirect
won't work for you because you have a dynamic server name. ForRedirect
you have to know the hostname of the redirect target in advance. Hopefully someone will find the bug for you. I personally find Apache rewrite rules confusing :-(rewrite
. Let me get back to you on the error log. Thanks!