I have a simple question about url or domain redirect. I was looking through the previous questions on how to redirect a url or domain from http to http to force using ssl.
The weird part shows up when I try to redirect none www. to www. with the domain. I tried many ways, but none worked for me. does any one have any idea why is that?? and how to resolve this issue??
here is the code for I used at .htaccess:
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^/?$ "https\:\/\/www\.mydomain\.com\/main" [R=301,L]
another weird thing is that whenever I typed the domain on the browser without www. there is an error message, but when I insert the www. in front of the domain, it redirects with https and wwww of course.
any idea?
Thanks
You rules will run into a loop. Do this instead: