さくらインターネットでMovable TypeのDynamic Publishingを使う
先日は「さくらインターネットのスタンダードプランだとMovablye Typeのダイナミックパブリッシングができない」なんて書いたけど、あれから調べたらちゃんと使えることがわかった。
さくらインターネットのスタンダードプランにある制限は、正確には「Apacheの.htaccessでOpthionsが使えない」というもの。実際に.htaccessにOptionsの記述があると、Internal Server Errorとなってしまう。
Movable Typeでダイナミック・パブリッシングを有効にすると、自動的に.htaccessファイルが作られて、必要なApacheの設定を記述してくれる。そのなかにOptionsがあるせいで、さくらのレンサバではダイナミックパブリッシングが動かなかったのだ。
もう少し詳しくMovable Typeが作る.htaccessのファイルの中身を見てみよう。
## %%%%%%% Movable Type generated this part; don't remove this line! %%%%%%%
# Disable fancy indexes, so mtview.php gets a chance...
Options -Indexes +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
# The mod_rewrite solution is the preferred way to invoke
# dynamic pages, because of its flexibility.
# Add mtview.php to the list of DirectoryIndex options, listing it last,
# so it is invoked only if the common choices aren't present...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.htm default.htm default.html default.asp /blog/mtview.php
</IfModule>
RewriteEngine on
# don't serve mtview.php if the request is for a real directory
# (allows the DirectoryIndex lookup to function)
RewriteCond %{REQUEST_FILENAME} !-d
# don't serve mtview.php if the request is for a real file
# (allows the actual file to be served)
RewriteCond %{REQUEST_FILENAME} !-f
# anything else is handed to mtview.php for resolution
RewriteRule ^(.*)$ /blog/mtview.php [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
# if mod_rewrite is unavailable, we forward any missing page
# or unresolved directory index requests to mtview
# if mtview.php can resolve the request, it returns a 200
# result code which prevents any 4xx error code from going
# to the server's access logs. However, an error will be
# reported in the error log file. If this is your only choice,
# and you want to suppress these messages, adding a "LogLevel crit"
# directive within your VirtualHost or root configuration for
# Apache will turn them off.
ErrorDocument 404 /blog/mtview.php
ErrorDocument 403 /blog/mtview.php
</IfModule>
## ******* Movable Type generated this part; don't remove this line! *******
問題なのは3行目にある
Options -Indexes +SymLinksIfOwnerMatchの設定だ。これは何の設定かというと「ディレクトリインデックスの表示を無効にする」「シンボリックリンクを有効にする」というもの。
細かい説明は省くと、実はこの設定はあえてしなくても問題ない。シンボリックリンクはもともと有効になっているし、ディレクトリインデックスが見えないようしたいならほかの方法で対処可能だ。
というわけで、この1行をコメントアウト、または削除してしまえばダイナミックパブリッシングが可能になる。
こんな簡単なことに気がつくまでに1ヶ月も掛かっちゃったよ。
















