简体   繁体   中英

How to redirect selected pages from HTTP to HTTPS

I would like to redirect some of my pages on my site from http to https . Those selected pages all contain a keyword, for example " purchase "

http://domain.com/producta-purchase >https...

http://domain.com/productb-purchase >https...

How can I do it in .htaccess ?

You can use that in your .htaccess :

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} purchase [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM