I need to add a page in Sitecore:
abc.com/link1?id=1*something=BLABLA
abc.com/link2?id=2*something=BLABLA
abc.com/linkN?id=N*something=BLABLA
All of the links above represent a single page, which in turn serves the user a template based on link1
, link2
... linkN
.
It sounds to me like you can just create three new items (link1, link2, and linkN). These items can share the same "base" template that contains everything they have in common (Layout, common/shared Controls, etc.). Form there, if you need each one to be slightly different, you can create a new set of templates for each item that inherit from the base template (recommended), or modify the presentation details on each item directly.
That said, if you truly need a single item that accepts multiple routes and query strings, you have a few options:
If the item exists at the root of your site, you can create a single item and make Aliases for any other names you wish to route to the item. For example, an item named link can have aliases for link1, link2, linkN, etc. The query strings will work across all aliased pages. Using this approach, you would not be changing "Layout" as you described. Rather, your Layout (or one or more Sublayouts) would react to the available query strings and offer up different views and/or behavior. I like to call this making the Sublayout "smarter" :)
If you need a more robust solution that allows routing beyond the root of the site, you may want to look into extending the UrlResolver in the HttpRequest pipeline.