用于基于域的重写的 IIRF 正则表达式
我已经看到了大量基于子域的 URL 重写示例,但我正在尝试基于域名本身进行 URL 重写,特别是提供包含域名的子文件夹中的内容。
例如,我想要
http://www.site1.com/ sub/folders/long-html-filename.htm 被重写为 任何一个 /sites/www.site1.com/sub/folders/long-html-filename.htm 或者 http://www.masterdomain.com /sites/www.site1.com/sub/folders/long-html-filename.htm
我已经能够自己做很多重写正则表达式,但我在这方面遇到了障碍一。
谢谢!
I have seen a ton of examples for URL rewrites based on the subdomain, but I am trying to do URL rewrites based on the domain name itself, specifically serve content from a subfolder with the domain name in it.
For instance, I'd like
http://www.site1.com/sub/folders/long-html-filename.htm to be rewritten to
either
/sites/www.site1.com/sub/folders/long-html-filename.htm
or
http://www.masterdomain.com/sites/www.site1.com/sub/folders/long-html-filename.htm
I've been able to do a lot of the rewrite regex on my own, but I am hitting a brick wall on this one.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用 %{HTTP_HOST} 来捕获主机名?也许这样的事情会起作用:
Have you tried using %{HTTP_HOST} to capture the hostname? Maybe something like this would work:
凯文 - 你很接近。 IIRF 作者帮我完成了剩下的事情:
现在我只是想弄清楚如何将其与强制 WWW RedirectRule 结合起来。
另一个绊脚石......我有这个:
但它似乎不起作用,我只是超时了。
Kevin - you were close. The IIRF author got me the rest of the way there:
Now I am just trying to figure out how to combine that with a forced-WWW RedirectRule.
Another stumbling block...I have this:
But it doesn't seem to be working, I am just getting a timeout.