[Apache-Users 7647] Re: .htaccess のrewriteルール
Tsurutani Naoki
turutani @ scphys.kyoto-u.ac.jp
2010年 3月 13日 (土) 13:40:55 JST
こんにちは、鶴谷です。
"fujioka" <qhtsige @ apost.plala.or.jp> さん>
> 藤岡です。 .htaccess のrewrite ルールについて教えてください。
>
> 次のurl1,url2の場合、Internal server errorとなり、所望の変換ができません。
> error.logを見ると、どうも%や/文字が入る正規表現を変換することができないように見えます。
> どんな対策が良いでしょうか。
>
> 要求されたURL1 http://localhost/Rosa_/'Matilda/'.html
> 変換したいURL1 http://localhost/Rosa_'Matilda'.html /記号を削除。
>
> 要求されたURL2 http://localhost/Anemone%20debilis.html
> 変換したいURL2 http://localhost/Anemone_debilis.html %20を_記号に置き換える。
>
>
> .htaccess
> RewriteEngine on
> RewriteBase /
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^([0-9A-Za-z_.'=-%]+)\.html$ htmpage2.php?yspec=$1 [L]
[]内の-は、範囲指定じゃないでしょうか?
'-'そのものを指定したければ、エスケープが必要なはずです。
---
鶴谷直樹
turutani @ scphys.kyoto-u.ac.jp
Apache-Users メーリングリストの案内