0

I've implemented a pagination in my news list page and I've written a rewrite rule in order to set a pagination such "/news/2" as page number. Here's the rule:

<add name="paginazioneNotizie" virtualUrl="^~/news/(.[0-9]*){1,3}" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/news?page=$1" ignoreCase="true" redirectMode="Permanent" />

The problem is that my news permalink is: "news/my-news-title"

Basically when I click on pagination link such "news/3" I succesfully change the page but if I click on news permalink I cannot access directly to the news itself. I dunno how to change my rule in order to ignore (or something like that) a non-numeric request. Any help?

  • At the moment your regular expression will match a wildcard character and any zero or more digits (together) 1-3 times. That is @183423943274237423894274287924H812831093[10293939 would be valid. It seems like you just want `"^~/news/([0-9]+)$`. – ProgrammingLlama Nov 14 '22 at 10:36

0 Answers0