5丁目通信(仮称)

とある5丁目で活動する還暦を過ぎたWebプログラマーの覚え書きです。それとかかってくる迷惑電話や、家業のアパート経営について。

rewriteルールで悩んでいること。

Apacheあるサイトの引き継ぎの仕事。

/news_999_xxx.htmlを/news.php?a=999&b=xxx に変換するだけが、xxxに?とか*が含まれてOKという仕様だからルールが書けない。

[plain gutter=”false”]RewriteRule ^news_([0-9]+)_(.*)\.html$ /news.php?a=$1&b=$2 [/plain]

では、*がxxxに入るとマッチングしない。

[plain gutter=”false”] /news_123_abc*def.html[/plain]

そもそも*が含まれてるというところがダメなのか? 正規表現は難しい。

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny