LoginSignup
0
2

More than 5 years have passed since last update.

Apacheの自分用メモ

Posted at

URLクエリを判定する方法

URLクエリがdownload=trueならば、画像ファイルをダウンロードさせる設定を行った。(Apache2.2)

https://serverfault.com/questions/445857/make-apache-or-iis-add-a-header-if-a-certain-query-string-is-present:title 参照

httpd.conf
RewriteEngine on
RewriteCond %{QUERY_STRING} (^|&)download=true(&|$)
# 環境変数"X_ACCESS_DEVICE"にNULLを設定
RewriteRule .* - [E=X_ACCESS_DEVICE:NULL]
Header set Content-Disposition attachment; env=DOWNLOAD
httpd.conf
 <If "%{QUERY_STRING} =~ /action=login/">
     Require ip 192.168.178.100
 </If>
  • RewriteCond, RewriteRuleの使い方が難しいなあ。。。

RewriteRuleの使い方

http://oxynotes.com/?p=7392
https://httpd.apache.org/docs/current/rewrite/flags.html

0
2
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
0
2