簡體   English   中英

將某些頁面重定向到https,將其他所有頁面重定向到http

[英]Redirect some pages to https and other all pages to http

我找到了有關如何使用htaccess將某些頁面重定向到https並將其他頁面重定向到http的解決方案,請查看下面的答案以獲取更多詳細信息

Please use bellow .htaccess rules to redirect some pages to https and other pages to http,


RewriteEngine On

# Force SSL on my-listing and add listing pages
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (my-listing|new|choose-listing-type-plans)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Remove SSL on other pages
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css|js|woff|ttf|ico|php|txt|svg) [NC]
RewriteCond %{REQUEST_URI} !(my-listing|new|choose-listing-type-plans) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]



Thanks,
<h1>Nilesh G. Pangul</h1>
@http://www.facebook.com/nileshgpangul

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM