简体   繁体   中英

rewrite url from http to https using htaccess

I want links with https to forward to http, however they must meet the following condition:

Only url in the format https://example.com/non/ and what ever comes after the trailing slash are forwarded to http But links without the /non/ condition remain the same

I want to do this using htaccess

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTPS} on
RewriteRule ^non(/.*)?$ http://{HTTP_HOST}$1 [L,NC,NE,R=302]

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