사과하는 경우 사과하는 경우가 있습니다. 나는 모든 인터넷을 통해입니다 코드의 조각과 301 리디렉션을 설정 한 과거 Canonical https 및 www
는 :Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
그러나, 몇 가지이 특정 프로젝트에 대한 불확실 날 떠나.
1) 내가 HTTPS를 사용하여, 그래서 네 CNAMES 지금 거기에 올바른 용어?) https://example.com https://www.example.com http://example.com http://www.example.com
2)는 CMS를 사용하고 그이 필요 ((CNAME이 있다는 것입니다) .htaccess 파일을 사용하여 사이트를 실행할 때 CSS 및 기타 정보를 검색합니다. 따라서 저는 덜 기술적 인 사람으로서 .htaccess 파일을 조작하는 것에 대해 걱정하고 있습니다. (이전에이 파일을 잃어 버렸을 때 사이트가 작동하지 않는 별도의 문제가 발생했습니다)
질문 : 1) int .htaccess file 리디렉션을 배치합니까? 파일의 시작/끝? 2) https를 고려하여 위의 스 니펫을 어떻게 변경합니까? 여기
당신은이 HTTPS 또는www.example.com
또는 둘 모두와 함께 모든 요청을 리디렉션
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^.*$ http://example.com/$0 [R,L]
과 규칙을 앞에 수 http://example.com
모든 요청을 리디렉션하려면 htaccess로 코드
# Turn on URL rewriting only when mod rewrite is turn on
<IfModule mod_rewrite.c>
RewriteEngine On
# Installation directory
RewriteBase/
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system|tests|sql) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php?kohana_uri=$0 [L,QSA]
</IfModule>
# Protect the htaccess from being viewed
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
#Follow symlinks
Options +FollowSymlinks
아마도이 [답변] (http://stackoverflow.com/questions/2097542/use-htaccess-to-add-www-with-https-support)이 도움이 될 것입니다. –
달성하고자하는 것은 무엇입니까? HTTPS에서 어떤 일이 일어나지 않을까요? –
@Olaf 방문자가 4 가지 도메인 중 어떤 도메인인지에 관계없이 하나의 도메인 이름에 도착하길 원합니다. https://example.com –