I have a website hosted in IIS 8.5. The website is accessible by domain name publicly. I have added "HTTP Redirect" to redirect example.com
to example.com/project_name/folder
. And in IIS "Default document" I have included index.php
.
When I enter domain_name.com in browser, it shows example.com/project_name/folder/login
. But I don't want this full path to show in URL. I want it to appear as example.com/login
Can somebody share the detailed steps including regular expressions, that I need to do configure in URL rewrite to achieve this?
Here is my attempt : I have added a Url rewrite rule with the following config :
Name : URL_Shortening ; Match URL : Requested URL : Matches the pattern ; Using : Regular Expressions ; Pattern : ^dual-rebama.ndtv.com/[-a-zA-Z0-9_]+/[az]+/([az]+) ; Ignore case : true ; Action type : Rewrite ; Rewrite URL : dual-rebama.ndtv.com/{R:1} ; Append query string : true ;
Stop processing of subsequent rules : false
But this rewrite rule is not working. Please suggest where I'm going wrong.
If you want to redirect example.com/project_name/folder/login to example.com/login, you can try this rule:
<rewrite>
<rules>
<rule name="Remove testapp" stopProcessing="true">
<match url="^project_name/folder/(.*)$" />
<action type="Rewrite" url=http://dual-rebama.ndtv.com/{R:1} appendQueryString="false" />
</rule>
</rules>
</rewrite>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.