2014-05-12 73 views
0

我在.htaccess迫使HTTPS在我的網站的所有網頁使用此代碼如何強制單頁來代替https的HTTP在.htaccess

RewriteEngine on 
RewriteCond %{HTTPS} !=on 
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] 

但是我有一個頁面videos.php其我不想要https,我希望它是正常的http,我該怎麼做?誰能幫忙?

回答

1

嘗試改變.htaccess

RewriteEngine on 
RewriteRule ^videos.php - [L,NC] 
RewriteCond %{HTTPS} !=on 
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] 

這將檢查與videos.php結尾的網址,並不會做這些網址什麼。

0

你可以有你的規則是這樣的:

RewriteEngine on 

# force HTTPS for all pages except videos.php 
RewriteCond %{HTTPS} off 
RewriteRule !^videos\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] 

# force HTTP for all pages except videos.php 
RewriteCond %{HTTPS} on 
RewriteRule ^videos\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]