1

I recently added SSL to my site. I want to write a redirect rule in .htaccess. When I am trying to access http://the.mydomain.com/signup it wants to redirect to https://the.mydomain.com/envelop.

  1. http://the.mydomain.com/login -> https://the.mydomain.com/login

  2. http://the.mydomain.com/work -> https://the.mydomain.com/work

I have checked lots of rules, but they didn't work for me.

halfer
  • 19,824
  • 17
  • 99
  • 186
zam
  • 269
  • 1
  • 2
  • 4
  • you want if somone hits `http://the.mydomain.com/signup` he should automatically redirect to `https://the.mydomain.com/envelop` , i.e., http to https – user2936213 Jan 08 '14 at 13:14
  • oh its my mistake sorry , My requirement is if some one hits 1.http://the.mydomain.com/signup it should automatically redirect to https://the.mydomain.com/signup 2. http://the.mydomain.com/login -> https://the.mydomain.com/login, 3.http://the.mydomain.com/work -> https://the.mydomain.com/work – zam Jan 09 '14 at 05:38
  • All are same? Whats the difference? – user2936213 Jan 09 '14 at 06:07
  • I have checked below rules mentioned , but they didn't work for me. – zam Jan 09 '14 at 06:40

3 Answers3

2
RewriteEngine
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
deW1
  • 5,562
  • 10
  • 38
  • 54
1
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Copy of Force SSL/https using .htaccess and mod_rewrite

Community
  • 1
  • 1
GuyT
  • 4,316
  • 2
  • 16
  • 30
0

You can Try this:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1
user2936213
  • 1,021
  • 1
  • 8
  • 19