2013-07-25

SetEnvIf の Request_URI には Query String は含まれない

クエリストリングを含んでいたときだけ、ログに記録したくなかたったので、調べてみた。

まぁ、結論はタイトルに書いてあるのだが、

これを知らなかったおかげで、1時間無駄にした。


じゃあ、どうやって制御するかというとこんな感じ。

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/hogehoge/index\.html
    RewriteCond %{QUERY_STRING} id=123
    RewriteRule ^(.*)$ $1 [E=nolog:1]
</IfModule>
CustomLog "| /usr/sbin/rotatelogs /var/log/httpd/access_log.%Y%m%d 86400 540" combined env=!nolog


/hogehoge/index.html
はログに記録されるけど

/hogehoge/index.html?id=123
はログに記録されない。

2013-07-12

HTTP_HOST と SERVER_NAME の違い

あざーっす。

http://phpspot.org/blog/archives/2006/05/server_namehttp.html


--2013/9/17 追記--
上の説明を読んで色々試してみたんだけど、やっぱり違いがわからなかった。
そんな時は、やっぱりドキュメント読まなきゃね。

■Apache HTTP サーバ バージョン 2.2 ドキュメント
UseCanonicalName ディレクティブ

2013-07-01

maillogの世代管理

maillogの世代管理を、デフォルトの4週間から1年(54週)に延ばす。

# cd /etc/logrotate.d/
# cp syslog mail
# vi mail

/var/log/maillog {
    rotate 54
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}


# vi syslog

/var/log/messages /var/log/secure /var/log/spooler /var/log/boot.log /var/log/cron {
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

Chatの「メッセージは投稿者によって削除されました」を非表示にする方法

Chrome拡張機能を自作してやってみよう! ♪できるかな できるかな ・・・ 無理ぽ (´・ω・`) iframeの中に、実際のメッセージのやり取りが表示されるので、 $(function(){ $('iframe[name^="spa...