2007年11月 7日

mod_rewriteを使おうと思ったんだけども

このサーバのTOPの方がpukiwiki plusで構成されているので、URLが全てindex.php?記事名という状態であまり行儀が良くない。
そこで、mod_rewriteで処理かまそうと思ったのだが一応はうまくいく。構文としてはこんなん

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /index.php?$1 [L]

確かに動作はする。
しかしapacheのエラーログを見ると

[error] File does not exist: /home/www/html/abc, referer: http://karinto.mine.nu/abc/
[error] File does not exist: /home/www/html/abc, referer: http://karinto.mine.nu/abc/
[error] File does not exist: /home/www/html/abc, referer: http://karinto.mine.nu/abc/
[error] File does not exist: /home/www/html/abc, referer: http://karinto.mine.nu/abc/
[error] File does not exist: /home/www/html/abc, referer: http://karinto.mine.nu/abc/

こーんな感じで毎回5行ほどエラーログを吐いてしまう。
rewrite処理かかっていてもエラーは吐くという事なのだろうか?
これでは正直使えない。

RewriteOptions MaxRedirects=1

をしたいのだが、これを入れると常時ワーニング。

[warn] RewriteOptions: MaxRedirects option has been removed in favor of the global LimitInternalRecursion directive and will be ignored.

ワーニングが全てのアクセスで記録されるのでログがやばい事になってしまふ。
MaxRedirectsが使えないとどうにもならんから、しばらくは解決方法を探すしかないなぁ。

LimitInternalRecursion 5
であるから、無限ループに入って5回で止まっているのだろうけども、何で無限ループになるんだろうなぁ。単純にDIRの存在しないアドレスだったらindex.php?アドレスというrewriteのはずなんだけども。


トラックバックURL

このエントリーのトラックバックURL:
http://karinto2.mine.nu/blog/mt-tbx.cgi/291

コメントする