I have a standard wordpress installation with no plugins residing in /var/www/blog on my root server. It uses an Apache2, mod_rewrite, mod_ssl and that is configured just fine and works perfectly for anything but WordPress.
My .htaccess is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#RewriteCond %{SERVER_PORT} !^443$
#RewriteRule (.*) http://%{SERVER_NAME}%{REQUEST_URI}
#RewriteCond %{HTTP_HOST} ^somesite.info [NC]
#RewriteRule (.*) https://somesite.info%{REQUEST_URI} [R=301,L]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
A couple of things are wrong:
- I need http and https,
http://www.
andhttps:/www.
- FF displays my site just fine, Chrome loads the CSS and JS from http:// – that is bad
I have added the variables to the wp-config.php:
define('WP_HOME','http:/somesite.info/blog');
define('WP_SITEURL','http://somesite.info/blog');
How can I define the variables so that all the 4 possible URL schemes get supported?
The shown rewrite conditions in comments make me end up in a redirect loop.
My WordPress is behind a reverse proxy, so I assume the .htacess stuff doesn’t fit.
Best,
ww
I’m using a plugin for this called WordPress HTTPS. If you still intend to code a solution yourself, maybe you can get some ideas from it at least.
Read about WordPress is_ssl() not working behind reverse proxies and install the SSL Insecure Content Fixer plugin so that you can easily test whether you can add a fix based on
$_SERVER['HTTP_X_FORWARDED_PROTO']
; see that plugin’s FAQ.If you have the misfortune to be hosted by Network Solutions, you can fix your problem by installing this simple plugin and setting your home and site URLs to use https: full time.