Top Ad unit 728 × 90

How to redirect www http to https htaccess

How to fix your problem and cause both www and non-www to be redirected to https very easy.

Redirect All to  https://www

To first force HTTPS, you must check the correct environment variable %{HTTPS} off, but your rule above then prepends the www. Since you have a second rule to enforce www., don't use it in the first rule.
------------------------------------------------------------------------------------
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

------------------------------------------------------------------------------------

About proxying

When behind some forms of proxying, whereby the client is connecting via HTTPS to a proxy, load balancer, Passenger application, etc., the %{HTTPS} variable may never be on and cause a rewrite loop. This is because your application is actually receiving plain HTTP traffic even though the client and the proxy/load balancer are using HTTPS. In these cases, check the X-Forwarded-Proto header instead of the %{HTTPS} variable


Redirect http to https and www to non www

You can get what you need from the HTTP_HOST
This way it will get the host always without the subdomain.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
RewriteRule (.*) https://%1%{REQUEST_URI} [L,R=301]

Redirect all http to https for wordpress

if you need redirect all http your link website  to https for wordpress. You can see

------------------------------------------------------------------------------------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

------------------------------------------------------------------------------------


How to redirect www http to https htaccess Reviewed by Unknown on August 24, 2017 Rating: 5

No comments:

All Rights Reserved by The Best How To Guides, Tips and tricks Technology © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Biểu mẫu liên hệ

Name

Email *

Message *

Powered by Blogger.