How to convert a subdomain to a path with Embedded Tomcat 8 and Spring boot

前端 未结 4 1420
执念已碎
执念已碎 2021-02-06 04:57

How to rewrite subdomains to paths?

Example:

  • foo.bar .example.com --> example.com /foo/bar

Or better woul

4条回答
  •  -上瘾入骨i
    2021-02-06 05:35

    You can use Backreferences to use grouped parts that matched in your . Something like this -

    (*).(*).example.com
    ^(.*)
    example.com/%1/%2
    

    Of course, you'll have to tweak the condition rule above to stop eager matching.

    More here - http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html#condition

提交回复
热议问题