Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite to SSL

ssl

         

stefan009

7:00 pm on Feb 2, 2011 (gmt 0)

10+ Year Member



Do you have an idea how I can remove www and reirect all requests to https//

There is a problem with the code misses the www

RewriteCond %{HTTP_HOST} !^(mydomain\.com)?$ [NC,OR]
RewriteCond %{SERVER_PORT} 80 [NC]
RewriteRule ^(.*)$ [mydomain.com...] [R=301,NC,L]

www not working, eg. [mydomain.com?...]

Stefan

g1smd

7:15 pm on Feb 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need two blocks of code and they will be "symmetrical" in operation.

Both will test the port number, and both will redirect specific requests.

As this is a question that comes up every week, at least once, there are very many prior threads with example code.

stefan009

11:30 am on Feb 5, 2011 (gmt 0)

10+ Year Member



[webmasterworld.com...]

Hi g1smd, thank you for that answer. I will look further for suitable examples. - stefan

[edited by: stefan009 at 12:22 pm (utc) on Feb 5, 2011]

g1smd

11:53 am on Feb 5, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



These specific threads should get you started:
[google.com...]

stefan009

3:23 pm on Feb 7, 2011 (gmt 0)

10+ Year Member



RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) [%{HTTP_HOST}%{REQUEST_URI}...]

CGI .htaccess

jdMorgan

11:22 pm on Feb 7, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?([^.:]+(\.[^.:])+)(\.?:[0-9]+|\.)?$
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]

Jim