2013-01-19 2 views
0

임 : htaccess를 다시 쓰는 데 문제가 있습니다. 내 사이트의 다른 부분을 http가 아닌 https로 리디렉션해야합니다 (예 : 로그인 및 뉴스 섹션). 정확한 mannor에서 이것을하는 방법에 대해 확실하지 않습니다..htaccess를 설정하는 방법은 동일한 사이트의 http 및 https를 다시 씁니다.

그래서 순간에 나는 HTTPS이 리디렉션 싶습니다

RewriteRule ^login/?$ index.php?p=login [R,L] 

, 나는 다음과 같은 시도가 있지만,

RewriteRule ^login/?$ https://%{SERVER_NAME}/index.php?p=login [R,L] 

을 제대로 작동 나던하지만 제대로 작동 나던 . 내가 놓친 게 있니? 다른 모든 설정을 다시 쓸 수 있습니다. 내가 뭘 놓치고 있니?

htaccess가 https가 설정되지 않은 다른 규칙 집합을 사용하도록 설정하는 방법이 있습니까?

업데이트 :

그래서 내가하고 싶은 것을 https://www.site.tld/login/codehttp://www.site.tld/login/ 재 작성을 재 작성하고 더 https://www.site.tld/index.php?p=login에 다시입니다. https://www.site.tld/login/하지만 실제로 https://www.site.tld/index.php?p=login

답변

0
RewriteEngine On 
# This will enable the Rewrite capabilities 

RewriteCond %{HTTPS} !=on 
# This checks to make sure the connection is not already HTTPS 

RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] 

특정 디렉토리하고있다 : 그래서 사용자가보고

여기
RewriteEngine On 
# This will enable the Rewrite capabilities 

RewriteCond %{HTTPS} !=on 
# This checks to make sure the connection is not already HTTPS 

RewriteRule ^/?secure/(.*) https://%{SERVER_NAME}/secure/$1 [R,L] 
# This rule will redirect all users who are using any part of /secure/ to the same location but using HTTPS. 
# i.e. http://www.example.com/secure/ to https://www.example.com/secure/ 
# This means if you dont want to force HTTPS for all directories you can force it for a specific sub-section of the site. 

더 : http://wiki.apache.org/httpd/RewriteHTTPToHTTPS

+0

이 나던 것이하지만 내 문제를 해결, 내가 특정 작업을 수행하는 방법을 알고를 http to https 트릭을 사용하지만 http : //www.site.tld/login/을 https : //www.site.tld/login/code로 다시 작성한 다음 https : //www.site로 다시 작성하는 방법 tld/index.php? p = login. 따라서 사용자는 https : //www.site.tld/login/을보고 있지만 실제로 https : //www.site.tld/index.php를하고 있습니까? p = login – Tony

관련 문제