i wasted a lot of time looking for an answer to that question but no luck i was able to redirect from http://xx.com to https://www.xx.com and http://xx.com to http://www.xx.com but this case isn't working at all : https://xx.com to https://www.xx.com i could do it via php but i need to do it using htaccess since i don't want to accept the certificate before redirection , i want to redirect first to go to the verified www-domain certificate . i hope some one has a genius idea to do it .
could you at least post here the code you have been trying, so we can see if there's any way to fix it. thanks.
Try the following code for your htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^xx.com$ RewriteRule ^.* https://www.xx.com$1 [R=301,L] </IfModule> Code (markup): Good luck
I prefer <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www.xx.com$ RewriteRule ^.* https://www.xx.com$1 [R=301,L] </IfModule> Code (markup):
Exactly, the OP wants to redirect to www. This also redirects things like ww.xx.com and wwww.xx.com, etc.
i already solved this guys using php . the problem about the above posted code is when some body access the site using : https://xx.com no redirect will happen , so i solved it using a global included few lines.