[Apache-Users 7629] Re: htaccessのリダイレクト
fujioka
qhtsige @ apost.plala.or.jp
2010年 2月 10日 (水) 18:40:02 JST
先の投稿で、\&のところで誤記がありましたので、訂正です(投稿用原稿だけで作成したので、実際のファイルと違ってしまいました)。
藤岡です。 色々試しました。
(1)最初に試していたケース。 index.htmlはヒットするが、変換が駄目。
入力url http://localhost/index.html
RewriteEngin on
RedirectMatch 301 ([0-9A-Za-z_.'=-]+)\.html$ mkpage2.php?yspec=$1&src=html
index.htmlは mkpage2.php?yspec=indexindex.htmlsrc=html(accsecc.log) -->
hitはするが変換がだめ。
(2)&をエスケープする。 index.htmlは正常に変換された。
入力url http://localhost/index.html
RewriteEngin on
RedirectMatch 301 ([0-9A-Za-z_.'=-]+)\.html$ mkpage2.php?yspec=$1\&src=html
mkpage2.php?yspec=index&src=html(accsecc.log) ---> ok 実際はそんな名前が無いので404
(3)文字数は6文字以上(indexは5文字)なので、字数条件を加えた。すると、index.htmlはヒットせず、変換すべき実データPoa_alpinaにたいしては、変換されなかった。
入力url http://localhost/index.html
RewriteEngin on
RedirectMatch 301 ([0-9A-Za-z_.'=-]{6-99})\.html$
mkpage2.php?yspec=$1\&src=html
http://localhost/index.html --> /index.html ok
入力url http://localhost/Poa_alpina.html --> /Poa_alpina.html
(accsess.log) 変換されないNG
pass through D:/upload/Poa_alpina.html (rewrite_log) 変換されていない
(4)先頭に^\/を入れてみたが、同じくNG。
RewriteEngin on
RedirectMatch 301 ^\/([0-9A-Za-z_.'=-]{6-99})\.html$
mkpage2.php?yspec=$1\&src=html
http://localhost/Poa_alpina.html --> GET /Poa_alpina.html (accsess.log)
変換されないNG
pass through D:/upload/Poa_alpina.html (rewrite_log) 変換されていない
(5)挿入位置を、RewriteEngin on の前に入れる。 結果は同じくNG。
RedirectMatch 301 ^\/([0-9A-Za-z_.'=-]{6-99})\.html$
mkpage2.php?yspec=$1\&src=html
RewriteEngin on
"GET /Poa_alpina.html HTTP/1.1" 404 1122 (accsess.log)
pass through D:/upload/Poa_alpina.html (rewrite_log) RewriteEnginの前に入れたが何故かログされている。
自分の考察
結局index.html はうまく変換動作するが、 長いurlの実データではヒットしないと見える。文字数条件のあたりがまずいか?
お助けをお願いします。
Apache-Users メーリングリストの案内