.htaccess - url redirection from http://, www, and http://www to only https://domainname.com -


can me url redirecting .htaccess file?

i want redirect url 1 , https://mydomain.com

if types "www" or "http://" or "http://www" or "https://www", user should go https://mydomain.com

thanks! amit

you need 2 rules. in cases there double redirection tho.

 <ifmodule mod_rewrite.c>    rewritecond %{http_host} ^www\.(.+)$ [nc]    rewriterule ^ https://%1%{request_uri} [r=301,l]     rewritecond %{server_port} !^443    rewriterule ^ https://%{http_host}%{request_uri} [r=301,l]  </ifmodule> 

edit: remove www part.

please note ssl cert match site.com not www.site.com, cause security alerts when access via https://www, i'm not sure can avoid htaccess rules.

the first rule trigger , redirect https:// + www https:// without www, alert might fire anyway. give try.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -