LoginSignup
2
1

More than 3 years have passed since last update.

【cakePHP3.x】常時SSL化対応

Posted at

cakePHPで作ったPJをさくらレンタルサーバに反映させたのですが、さくらの案内通りだとうまくいかなかったので.htaccessファイルのメモ

さくらの案内

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

実際はwebroot/.htaccessを下記に変更

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1