0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

エイプリールフールに使える、おかしな .htaccess 設定

Posted at

フェイクなファイルを作ってみましょう。

一例をあげていますが、どのような組み合わせでも可能です。

PDFに偽装したHTML

.htaccess を指定するほどでもありません。

mkdir sample.pdf
cd sample.pdf
touch index.html

jpg に偽装した HTML

perl のCGIスクリプトの例です。

.htaccess
RewriteCond %{QUERY_STRING} (^|&)hash=([^&]+)($|&)
RewriteRule .* - [E=X_QUERY_HASH:%2]

RewriteRule ^(.+)\.jpg$ index.cgi?u=$1&mode=html&hash=%{ENV:X_QUERY_HASH}
RewriteRule ^(.+)\.JPG$ index.cgi?u=$1&mode=jpg&hash=%{ENV:X_QUERY_HASH}

小文字の拡張子 jpg は HTML生成用を仮定しています。
大文字のJPGは、動的なJPEG画像の生成を仮定しています。
もし、普通のファイルのJPEGを表示する場合、
拡張子 .jpeg を指定します。

もしくは、他の形式のファイル (.png .gif .webp等)を検討します。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?