Quantcast
Channel: BulletProof Security Forum » All Posts
Viewing all articles
Browse latest Browse all 12461

Reply To: WordPress SSL htaccess code – Rewrite SSL, RewriteCond %{SERVER_PORT}

$
0
0

Load Balancers and SSL Redirect

If Apache is behind a Load Balancer , Pound, HaProxy, Nginx.

Then your  requests coming from the load balancer arrive over HTTP to Apache, so the HTTPS variable is set to OFF. Therefore, .htacess is reading HTTPS OFF from the server.

However, Apache Server does have a SSL variable called HTTP_X_FORWARDED_PROTO that can be used.


#WP REWRITE LOOP START for Load Balancers
RewriteCond %{HTTP:X-Forwarded-Proto} !https 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
or
#WP REWRITE LOOP START- For Load Balancers
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Directions:

WordPress General Settings:
WordPress Address (URL)    https://www.your-domain-name.com
Site Address (URL)                https://www.your-domain-name.com

1. Copy this .htaccess code below to this BPS Root Custom Code text box: CUSTOM CODE WP REWRITE LOOP START: Add www to non-www/non-www to www code here
2. Click the Save Root Custom Code button.
3. Go to the Security Modes page and click the Create secure.htaccess File AutoMagic button.
4. Activate Root Folder BulletProof Mode.


Viewing all articles
Browse latest Browse all 12461

Trending Articles