Home>

If RewriteCond has multiple lines,
Is there a way to use the first regular expression value in RewriteRule?

RewriteEngine on
RewriteCond% {REQUEST_URI} tokyo/([a-z] +)/([a-z] +) /
RewriteCond% {QUERY_STRING} ^ page = ([0-9] +) $
RewriteRule ^. * $Https://masao.co.jp/%1_ku/%2_cho/?pagenumber=%3 [L]

Redirect URL: https://hideo.co.jp/sinjuku/kabuki/? page =10

Redirect to: Ideal: https://masao.co.jp/sinjuku_ku/kabuki_cho /? pagenumber =10

  • Answer # 1

    Are you going to use a character that doesn't appear in the URL and put it on one line?

    RewriteEngine on
    RewriteCond% {REQUEST_URI}?% {QUERY_STRING} tokyo/([a-z] +)/([a-z] +) /.* \? Page = ([0-9] +) $
    RewriteRule ^. * $Https://masao.co.jp/%1_ku/%2_cho/?pagenumber=%3 [L]