2015-03-13 93 views
0

我想強制所有客戶端使用SSL訪問我網站上的HTML文件。在我的根文件夾中是snipprintslive.htmlwww.stellamays.co.uk/sniprintslive.html使用.htaccess強制一個HTML頁面通過SSL打開

我已經試過:

RewriteEngine On 
#https 
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule ^sniprintslive https://stellamays.co.uk/sniprintslive [R=301,L] 

該方法適用於網站,但訪問的其餘部分sniprintslive.html給出「找不到文件」的錯誤。

我試着把頁面放在一個子文件夾(相對鏈接的噩夢,但嘿嘿),並將.htaccess文件放在同一個文件夾中。

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} printsfolder/sniprintslive.html 
RewriteRule ^(.*)$ https://www.stellamays.co.uk/printsfolder/sniprintslive.html$1 [R,L] 

我再次收到同樣的錯誤。

我不明白這個編程語言,但想知道是否wwwhttp:東西是令人不安的東西。

請注意,我的服務器將與.htaccess一起使用,因爲我成功地強制使用類似代碼的HTTPS打開整個網站。

+0

您是否仍然有興趣知道您的原始解決方案爲什麼不起作用? – Palec 2015-03-13 18:59:10

回答

0

修復它與此...我有點害怕的代碼因爲我沒有把我的網站在??? ???! 但它的工作發展

RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} /sniprintslive.html 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]