2009-08-01 131 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]