Organizational Research By

Surprising Reserch Topic

http.con using the http:// and http://www. to https://www



asked Sep 13, 2013 in htaccess by rajesh
edited Sep 12, 2013
0 votes
32 views



Related Hot Questions

3 Answers

0 votes
Both of your codes don't work. At the moment I have this one and that works but only for http (without "s") # http to www # RewriteCond %{HTTP_HOST} !^www\..* [NC] RewriteCond %{HTTP_HOST} !^.*\..*\..* [NC] RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013
0 votes
Well, I found a little typo to fix in my last comment, and want to know which part is wrong if these config not works as you expected: RewriteCond %{HTTPS} !=on RewriteRule .* https://www.mydomain.com%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} !^www\.mydomain\.com RewriteRule .* https://www.mydomain.com%{REQUEST_URI} [R=301,L] Above consists of two parts: If url was not starts with https://, redirect to https://www.mydomain.com/ regardless of the hostname or rest of the url If url hostname is not www.mydomain.com, redirect to https://www.mydomain.com/ , in any case the url is http:// or https:// UPDATE: Finally, got a chance to test by myself. Matching rules didn't work as I expected, for some reason. Replaced wildcard ($1) as %{REQUEST_URI}, and pattern ^/(.)$ as
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013
0 votes
here's what you can put in your .htaccess file RewriteEngine On SSLOptions +StrictRequire SSLRequireSSL RewriteCond %{HTTPS} !=on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...