2017/09/22

Drupal8をさくらスタンダードに入れると 500 Internal Server Error になった

ちまたではiPhone 8 発売の熱狂に包まれる中、
Drupal 8をさくらスタンダードにインストールすると 500 Internal Server Error が出て泣いた。

## 解決方法
Drupal 8をインストールした直下「/とする」にある /.htaccess を開いて、
以下の記述がある行のコメントアウトをはずせばうごく。
~~~
RewriteBase /
~~~

## なにをやった

### 事件発生
1. インストーラに従ってインストールする
2. インストール完了
3. アクセスした
4. CSS適応されてない
5. 管理画面いこ...リンクをクリック
6. 『500 Internal Server Error』

CSS表示されてない、各メニューへのリンクは機能しない。引く。


### ぐぐった
[結果] 解決方法にめぐりあわなかった


### とりあえずエラーログをみる

#### 手順
1. さくらインターネットサーバコントロールパネルを開く
2. 「アクセスログの設定」を開く
3. 「エラーログの表示」でエラーログを開くとリダイレクトループしてるそう
~~~
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary.
~~~


### リダイレクトループからぬけだす

#### 手順
1. ははーん、さては mod_rewrite!! などと言いながら /.htaccess を開く
2. こうなってる
~~~
# RewriteBase /
~~~
3. こうしてみた
~~~
RewriteBase /
~~~
4. アクセスしてみたらCSSも適用されてるし各メニューへのリンクも機能してるしちょっともっさりしてるけどとりあえずOK


## .htaccess にちゃんと書いてくれてた
~~~
  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /
~~~

おわり