简体   繁体   English

htaccess重定向到http特定的URL,除http以外的所有URL

[英]htaccess redirect to http specific urls and all except on http

I am trying to redirect specific url to https and all other on http but not working properlym. 我正在尝试将特定的URL重定向到https和http上的所有其他URL,但无法正常工作。

http to https condition is working fine but except https url on http section not working httphttps条件正常,但http部分上的https url除外

i read multiple answer not multiple [OR] condition !^(login|brandcontroller|...) that has applied on https to http but not working 我读取了多个答案,而不是多个[OR]条件!^(login|brandcontroller|...) ,已在https上应用到http,但无法正常工作

     #HTTPS:// --> to --> HTTP:// (all url except https urls)
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} !^(login|brandcontroller|admin|archives|lightboxs|enquiries|uploaders|brandarchives|content) [NC] 
    RewriteRule . http://%{SERVER_NAME}%{REQUEST_URI} [L]

    #HTTP:// --> to --> HTTPS:// (specific urls)
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} ^(login|brandcontroller|admin|archives|lightboxs|enquiries|uploaders|brandarchives|content) [NC]
    RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [L]

can anyone help to htaccess redirect 任何人都可以帮助htaccess重定向

I founded way to set != {{REQUEST_URI}} in htaccess file 我建立了在htaccess文件中设置!= {{REQUEST_URI}}的方法

HTTP:// --> to --> HTTPS:// (specific urls) HTTP://->到-> HTTPS://(特定的网址)

RewriteCond %{HTTPS} off
# force https for all required URLs
RewriteCond %{REQUEST_URI} ^(?:login\/signin|forgot|brandcontroller|admin)
RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

HTTPS:// --> to --> HTTP:// (all home) HTTPS://->到-> HTTP://(所有主页)

# do not do anything for already existing files
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
# force http for all other URLs
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(?:login\/signin|forgot|brandcontroller|admin)
RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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