htaccess wordpress의 리디렉션 문제
Aug 02 2019
htaccess에 다음 리디렉션이 있습니다. Wordpress가 홈 폴더에 설치되어 있습니다. 사이트는 example.com (www없이)과 https를 리디렉션해야합니다. 워드 프레스 설치는 / home에 있습니다.
그리고 나는 그것을 고치는 방법을 모릅니다. 어떤 제안? 감사합니다 !!
RewriteCond %{HTTP_HOST} ^example.com$ RewriteCond %{REQUEST_URI} !^/home/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /home/$1 RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(/)?$ home/index.php [L] # BEGIN SSL <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^example\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END SSL```
답변
2 RohitKaushik Aug 02 2019 at 17:40
https로 리디렉션하도록 하위 폴더 또는 하위 도메인을 강제 할 수 없습니다.
https 리디렉션의 경우 이것을 사용하십시오.
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
하위 폴더 용
RewriteRule ^/?(.*) https://%{SERVER_NAME}/home/$1 [R,L]
또한 리디렉션에 기본 .htaccess를 사용할 수 있습니다.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>