Created
June 14, 2022 08:22
-
-
Save parasdaryanani/abe4241196304026a68fe77b9366367f to your computer and use it in GitHub Desktop.
Rewrite /news/t/todays-headlines as /news/todays-headlines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.webServer> | |
<!-- paste the following before the </system.webServer> closing tag --> | |
<rewrite> | |
<rules> | |
<rule name="UsePrettyUrls" stopProcessing="true"> | |
<match url="^news/([^/]+)/?$" /> | |
<conditions> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> | |
</conditions> | |
<action type="Rewrite" url="news?t={R:1}" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This UrlRewrite rule lets you create user friendly URLs that remove query params. For example, in this case when the user visits
/news/todays-headlines
the page content actually loads from/news?t=todays-headlines
ornews/t/todays-headlines