0

We would like to check whether the particular URL request having the bucket structure. If it is having, we just need to replace that value with blank values and do the redirection (only for article and not for other templates).

/article/2023/04/pagename

/article/year/month/pagename

Do we have any option in IIS rewrite rule?

1 Answer 1

1

First of all, IIS Rewrite Rule will not know your template so

only for article and not for other templates

part cannot be achieved, unless you can specify the part of url which is only present before the article name, e.g. /article.

I'm not sure what you mean by "If it is having, we just need to replace that value with blank values" - I assume you want to remove both year and month from the url and redirect. In that case, you can use the following rule:

<rule name="article redirect" enabled="true" stopProcessing="true">
 <match url="^(article)/[0-9]{4}/[0-9]{2}(.*)$" /> 
 <action type="Redirect" url="https://{HTTP_HOST}/{R:1}{R:2}" />
</rule>
1
  • Thanks Marek...
    – Astle
    Nov 9, 2023 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.