IIS URL REWRITE
On global level ass host settings you can find: %windir%\System32\inetsrv\config\applicationHost.config
Redirect all urls demo.blabla.com to qwe.blabla.com
(.*)
Match any:
{HTTP_HOST} ^demo.blabla(.*)
{HTTP_HOST} ^www.demo.blabla.com(.*)
{HTTPS} ^demo.blabla(.*)
Redirect:
http://qwe.blabla.com/
.*
(www.)?ips.indemo.com
Redirect:
https://ipss.redirect.com/{R:0}
indemo.buzz to but.ly
(.*)
Conditionak input: {PATH_INFO}
Matches the pattern
Pattern: /b/(.*)
Redirect
https://bit.ly/{C:1}
indemo.buzz to goog.gl
(.*)
Condition input: {PATH_INFO}
Matches the pattern
Pattern: /(.*)
Redirect
https://goo.gl/{C:1}
Sources
https://weblogs.asp.net/owscott/url-parts-available-to-url-rewrite-rules
https://blogs.iis.net/eokim/understanding-appcmd-exe-list-set-config-configurationpath-section-name-parameter-name-value
https://dbaland.wordpress.com/2019/02/13/create-a-http-to-https-url-redirect-in-iis-with-powershell/
Как настроить редиректы в IIS без боли?
Допустим ваш линк выглядит так: http://www.bing.com/search?q=IIS+url+rewrite
Разберем его на части: http(s)://<host>:<port>/<path>?<querystring>
Part
|
Example
|
Server Variable
|
http(s)
|
http
|
SERVER_PORT_SECURE or HTTPS = on/off
|
<host>
|
www.bing.com
|
HTTP_HOST
|
<port>
|
Default is 80
|
SERVER_PORT
|
<path>
|
search
|
The rule pattern in URL Rewrite
|
<path>
|
/search
|
PATH_INFO
|
<querystring>
|
q=IIS+url+rewrite
|
QUERY_STRING
|
entire URL path with querystring
|
/search?q=IIS+url+rewrite
|
REQUEST_URI
|
Важно отметить что символы /,: и ? бывают не включены в некоторые переменные сервера, важно понимать какие слэши включены для создания успешных правил.
On global level ass host settings you can find: %windir%\System32\inetsrv\config\applicationHost.config
Redirect all urls demo.blabla.com to qwe.blabla.com
(.*)
Match any:
{HTTP_HOST} ^demo.blabla(.*)
{HTTP_HOST} ^www.demo.blabla.com(.*)
{HTTPS} ^demo.blabla(.*)
Redirect:
http://qwe.blabla.com/
.*
(www.)?ips.indemo.com
Redirect:
https://ipss.redirect.com/{R:0}
indemo.buzz to but.ly
(.*)
Conditionak input: {PATH_INFO}
Matches the pattern
Pattern: /b/(.*)
Redirect
https://bit.ly/{C:1}
indemo.buzz to goog.gl
(.*)
Condition input: {PATH_INFO}
Matches the pattern
Pattern: /(.*)
Redirect
https://goo.gl/{C:1}
Sources
https://weblogs.asp.net/owscott/url-parts-available-to-url-rewrite-rules
https://blogs.iis.net/eokim/understanding-appcmd-exe-list-set-config-configurationpath-section-name-parameter-name-value
https://dbaland.wordpress.com/2019/02/13/create-a-http-to-https-url-redirect-in-iis-with-powershell/
Комментариев нет:
Отправить комментарий