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

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

$
0
0

I believe this would work, but this code has not been tested.  I think with SSL your Certificate is specific to the exact domain name.  So it would be better to setup your site so that it is using the correct domain name in WordPress settings and anywhere else.

# https/SSL www to non-www
# WP REWRITE LOOP START
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_PORT} ^80
RewriteCond %{HTTP_HOST} ^www\.domainname\.com$ [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ - [L]

# https/SSL non-www to www
# WP REWRITE LOOP START
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_PORT} ^80
RewriteCond %{HTTP_HOST} ^domainname\.com$ [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ - [L]
  • This reply was modified 2 hours, 55 minutes ago by  AITpro Admin.

Viewing all articles
Browse latest Browse all 12486

Trending Articles