Allow multiple URLs for this page
We're porting an old site using Sitefinity, so we use the Allow multiple URLs for this page properies to redirect old pages to new one.
That works well, except for pages with query string, such as ~/home.aspx?lang=fr
In our old site we use query string to handle multiple language, so we'd like to set ~/home.aspx to redirect to ~/home (that works) and ~/home.aspx?lang=fr to redirect to ~/fr/accueil. That last part doesn't work. When setting that url in the property box, we get: One or more of the specified additional URLs are invalid.
Is there any way to make this work?
Hello Pacarrier,
The current implementation of pages does not allow you to enter query string directly in the url of a page and we do not have an option for additional url. This is something that we are going to discuss and see how could be implemented. The simplest way to append some query string to the url is using another user control with a single public property where you can set the QueryString on page. The control will add the QueryString with Response.Redirect to the page inside Load event. I agree that this is not a good solution, because there will be always two requests to the page, but this is the simplest way to achieve your goal.
All the best,
Svetoslav Petsov
the Telerik team
I know this is an old thread, but has there been any update on this functionality? Has it been added to a later release, or is there a better way to accomplish this? Thank you.
Hello Steve,
For now, this behaviour is not planned to be changed. One way to implement this would be like I described in my post. However, for your specific case, there might be a better approach for this (for example a URL rewriter or something similar).
Greetings,Huzaifa,
For what it's worth, it's still a bug and I've seen no news that there's a plan to address it. However, all is not totally lost, as our team came up with a workaround for the issue. It's admittedly completely hacky, but it's allowed us to handle the issue.
The workaround uses "Allow Multiple URLs" in combination with the URL Rewrite module of IIS7. Basically, you create a rewrite rule that removes the html or aspx extension from the page you want to use as an additional URL and does a redirect to the new page. So, in your case, you would write a rule that redirects everything coming in as /<document>.html to just /<document> (It would create /directions.html to /directions in your example). Then, you add the ~/directions to the multiple URL field on the page in Sitefinity. So IIS redirects the traffic to an extensionless page that Sitefinity handles, and then Sitefinity handles the multiple URL mapping to the page you actually want to display.
Like I said, it's a complete hack and adds an extra level of redirect that simply should not be necessary - this is basic functionality that should have been available from day 1 without any weak workarounds. But, given the scenario, its the only solution that we could come up with to solve the problem.
Please let me know if this makes sense or if you need any clarification.
Hi Steve,
Thanks for replying. Your hack seems like what I am exactly looking for. I tried creating the rules but I think I am crafting it incorrectly...For instance I am following the guidelines as described here,
http://stackoverflow.com/questions/10210936/url-rewrite-remove-html-extension
but it does not seem to work. Can you possibly provide a working example of the rewrite XML specific to my case.
Here's the rule that we use:
<
rule
name
=
"Remove ASPX"
enabled
=
"true"
stopProcessing
=
"true"
>
<
match
url
=
"(.*)\.aspx"
/>
<
action
type
=
"Redirect"
url
=
"R:1"
/>
</
rule
>
Thanks Steve