簡體   English   中英

使用Regex重寫IIS7 URL

[英]IIS7 URL Rewrite with Regex

當用戶訪問我網站的某個URL時,我正在嘗試重寫URL:

Accessed URL: https://client1.domain.com

Rewritten URL: https://new-client1.otherdomain.com

我的網站上有許多指向它的URL,因此簡單的HTTP重定向模塊將不是有效的解決方案。 正則表達式將是什么,我想為重寫規則的每個部分填寫什么?

謝謝

嘗試這個:

s/client1.domain/new-client1.otherdomain/g

您可以使用此正則表達式模式搜索client1.domain來替換它:

(?<=//)([^.]+)\.domain

將其替換為對client1和新域的向后引用,如下所示:

$1\.otherdomain

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM