history73
history73

Reputation: 39

Redirect all url to the https with .htaccess

I want redirect all bellow links to the https:// medomain.com

http:// medomain.com, medomain .com, http:// www.medomain.com, https:// www.medomain.com, www. medomain.com

Redirect all to the https:// medomain.com

Can i help me?

Regards

Upvotes: 1

Views: 40

Answers (2)

todorojo
todorojo

Reputation: 21

Apache doesn't recommend using mod_rewrite to do this. The recommend using Redirect. See:

https://wiki.apache.org/httpd/RedirectSSL

Upvotes: 2

anubhava
anubhava

Reputation: 784868

You can do all this in a single rule, use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://medomain.com%{REQUEST_URI} [R=301,L,NE]

Upvotes: 0

Related Questions