urlrewriting に urlrewriting.net を使用しています。正規表現について助けが必要です(まだ得られません....)。
合わせたい
www.mysite.com/restaurant
-> マッチして "restaurant
"を返すwww.mysite.com/restaurant?page=1
-> マッチして "restaurant
"を返すwww.mysite.com/restaurant?[SOME_RANDOM_QUERYSTRING]
-> マッチして "restaurant
"を返すwww.mysite.com/seattle/restaurant
-> "seattle
" と " " をrestaurant
照合して返すwww.mysite.com/seattle/restaurant?page=1
-> "seattle
" と " " をrestaurant
照合して返すwww.mysite.com/seattle/restaurant?[SOME_RANDOM_QUERYSTRING]
-> "seattle
" と " " をrestaurant
照合して返すwww.mysite.com/seattle/restaurant-michelangelo
→捕まえないwww.mysite.com/seattle/restaurant/sushi
seattle
-> " " と "restaurant
" と " "sushi
を照合して返すwww.mysite.com/seattle/restaurant/sushi?page=1
seattle
-> " " と "restaurant
" と " "sushi
を照合して返すwww.mysite.com/seattle/restaurant/sushi?[SOME_RANDOM_QUERYSTRING]
seattle
-> " " と "restaurant
" と " "sushi
を照合して返すwww.mysite.com/seattle/restaurant-michelangelo
→捕まえない
ポイントは、クエリ文字列部分ではなく、URL のディレクトリ部分が必要なことです。問題は、私の Web 分析ツールから、人々が 2 つの単語で検索していることがわかります。どちらも都市 (シアトル) + カテゴリ (レストラン) を検索します。「シアトル レストラン」と都市 (シアトル) + レストランの名前 (restaurant-michelangelo) など。「シアトルレストラン・ミケランジェロ」。これは階層構造ではないため、構造的な観点から見ると、これはもちろんごちゃごちゃです。理想的な世界では、階層は都市 -> カテゴリ -> レストランです。しかし、私はまだこの検索動作を私の URL 構造に取り入れたいと思っています。同時に、国内のすべてのレストランをリストしたページもあります。
正規表現は非常に高価になる可能性があるため、正規表現の作成方法と最も効率的な作成方法について助けてください。
ありがとう
トーマス