0

I have a website that I'd like to redirect any http:// traffic to a few specific URL's to https:// instead.

The URLs I'd like to redirect to are like this:

http://www.domain.com/wp-admin/

http://domain.com/wp-admin/

http://www.domain.com/wp-login.php

http://domain.com/wp-login.php

Using this solution as a guide is this correct?

# Forcing HTTPS
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{SERVER_PORT} 80
# Pages to Apply
RewriteCond %{REQUEST_URI} /wp-admin/ [OR]
RewriteCond %{REQUEST_URI} /wp-login.php
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Community
  • 1
  • 1
Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79

1 Answers1

0

You almost got it right. Just some small corrctions:

# Forcing HTTPS
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^wp-admin/|wp-login\.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Also make sure these rules are right at top before any other WP rule.

anubhava
  • 761,203
  • 64
  • 569
  • 643