url-masking redirect http to https using .htaccess

nishant patel

I have created url-masking (url-mapping) on my portal. Same php code are running with different urls. My portal link is http://subdomain.domain.in (main-link) and client url is http://www.client-domain.com. I want to redirect client URL HTTP to https using my .htaccess file.

Edit from comment:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^client-domain.in [NC] 
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}/$1 [L,R=301] 
RewriteCond %{HTTP_HOST} ^mydomain.in [NC] 
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI}/$1 [L,R=301]
nishant patel

My problem is solved now. I have added this code in .htaccess, and client's url work with HTTPS.

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} www.client-domain.com [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^my-domain.in [NC]
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI}/$1 [L,R=301]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

.htaccess, redirect to https of http url

Redirect HTTP to HTTPS using htaccess?

Redirect https to http using htaccess in opencart

Redirect http to https with www using .htaccess

Using htaccess to redirect http to https for Wordpress?

.htaccess redirect http to https

Redirect to https using .htaccess

rewrite/redirect http:// and http://www to https:// using htaccess

.htaccess RewriteRule to redirect http to https messes up % escaped parameters in URL

HTTP to HTTPS redirect not working with .htaccess

Use .htaccess to redirect HTTP to HTTPs

HTTP to HTTPS redirect issue .htaccess

Htaccess redirect https to http for all pages except homepage, redirect https for homepage to another url

How to redirect https domain to http domain using htaccess?

URL Redirect / URL Masking

htaccess https redirect not using my latest css file? – http and https version of the site use different css

htaccess redirect domain to https, subdomain with parameter to http

Use htaccess to redirect users from http to https

Redirect only HTTP subdomain to HTTPS subdomain in htaccess

Redirect http to https in Yii2 .htaccess

.htaccess https to http redirect conflict with existing rule

.htaccess http www or non www redirect to https

.htaccess redirect to https except admin url

redirect HTTP to HTTPS using express

Selective url redirect using .htaccess

Redirect registration url using .htaccess

.htaccess redirect http/https www to https non-www

How to redirect http to https://www.example.com using htaccess file?

Using htaccess, Redirect http or https domain, and any subpage to particular page on another server