问题原文
原帖链接 · Esteban Chávez · CC BY-SA 4.0
I'm trying to redirect a website to HTTPS, but there is one URL that needs to be accessed via HTTP. Currently I just have this in .htaccess:
Redirect 301 / https://www.example.com
I need to have the following URL available through HTTP:
http://example.com/asistente/
It is an assistant page separate from the website, that in labor is accessed via QR code.
How can I force HTTPS for everything except that one page listed above?
社区高分解答
原帖链接 · Éric · CC BY-SA 4.0
I agree with Stephen's comment: HTTPS will not break the QR code itself.
There might be some hosting reasons to keep your QR-encoded URL untouched. I guess you may want to avoid any HTTPS issue (old browsers, etc.) with this URL (and its children).
Here are Apache directives which, in an .htaccess file, will redirect all requests to HTTPS, except http://(www.)example.com/asistente and its children URLs.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/asistente($|/)
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
