webman74
webman74

Reputation: 1

How to redirect http url to https url?

I want to redirect my wordpress login page to use HTTPS but do not want the rest of the site using it. I know how to redirect all the site via HTTP to HTTPS but not just a specific URL.

So I want http://example.com/wp-admin to go to https://example.com/wp-admin

This is what I currently have below and I have tried adding bits in but not got there.

Redirect / https://example.com/

Upvotes: 0

Views: 69

Answers (1)

Amit Verma
Amit Verma

Reputation: 41209

You need to use mod_rewrite to enable https for a specific url.

Try the following in htaccess :

RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule ^wp-admin/?$ https://%{HTTP_HOST}%{REQUEST_URI} [NC,L,R]

Upvotes: 1

Related Questions