2009-08-01 54 views
2

我有一個客戶端文件夾位於http://www.example.com/client 但是,我現在已經在服務器上安裝了SSL,並且希望使用HTACCESS添加永久重定向,以便無論何時/客戶端被訪問,它重定向於:https://www.example.com/clientRewriteCond和RewriteRule在.htaccess中

任何人都知道該怎麼做?

我重定向我的域名,在過去這樣的:

RewriteCond %{HTTP_HOST} ^example\.com$ [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 
RewriteCond %{HTTP_HOST} ^www.example\.com$ [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 

這應該不會影響解決方案,但該網站仍必須重定向到www.example.com,然後再以https://www.example.com/client如果例如,輸入http://www.example.co.za/client

+0

可能重複:http://stackoverflow.com/questions/1213404/using-htaccess-to-control-https-on-certain-pages/1214288#1214288 – Gumbo 2009-08-01 07:58:20

回答

1

試試這個:

RewriteCond %{HTTPS} !on 
RewriteRule ^client(/.*)?$ https://www.example.com%{REQUEST_URI} [L,R=301]