Dynamic 301 redirects

Posted by Community Admin on 03-Aug-2018 19:58

Dynamic 301 redirects

All Replies

Posted by Community Admin on 02-Oct-2012 00:00

Hi,

Anyone who knows a good way to setup 301 redirects for dynamic generated items? I've read too much this evening I think to come up with something good.

Thanks anyway,
Daniel

Posted by Community Admin on 05-Oct-2012 00:00

Hello Daniel,

Would it be possible to share some more details regarding the exact scenario you have in mind, please? 

Regards,
Atanas Valchev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 05-Oct-2012 00:00

I need to do this too, and here's what I'm planning...

1) Create a new custom field (long text) with the plain textarea box picked (not the radeditor), call it multipleUrls
2) Copy the Title\ExampleText from the page properties UI :)

Then in an HttpModule do a search for matches, and then redirect to the detail view of the appropriate item.  What's undecided for me is if I'll use the API or some custom SP to boost speed (assuming there's any noticeable difference)

...essentially copy what the page properties does.  The reason I like this is because I should be able to add a custom sidebar filter to show me content items that have or do not have this field filled out.

I do wish this was somehow native though...

Posted by Community Admin on 09-Oct-2012 00:00

Well, I have the following situation:

Legacy site
There is a product section which has these kind of urls:
www.website.com/.../product-detail.aspx

New site
On the new site a product page looks like this:
www.newwebsite.com/.../detail

So, no page extension and another ID inside the url parameters. The product ID is the same.
I'm not familiar with writing these HttpModules and Url Rewrite rules that make use of RegEx.

Daniel

Posted by Community Admin on 09-Oct-2012 00:00

Does the new site need to redirect to the old site, or just support the legacy URL format?

Posted by Community Admin on 09-Oct-2012 00:00

Hi MB,

No it just needs to support the legacy urls.

---
Daniel

Posted by Community Admin on 09-Oct-2012 00:00

I think that can be done fairly easily using the IIS URL Re-Write module.

www.iis.net/.../url-rewrite

Basically, you want a rule something like this: (paste into the <system.webserver> section of web.config, once you have installed the IIS URL ReWrite module)

<rewrite>
<rules>
<clear />
<rule name="ReDirect Old Product URLs">
<match url="^products/product-detail\.aspx\?product_id=([0-9a-z-_]+)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="products/detail?pid=R:1" />
</rule>
</rules>
</rewrite>

Note: This is quite specific, and you might need to adjust it to suit your needs, but there is a pattern-match tester built into the re-write module so that you can play with it.

Essentially, it's looking for your old URL format (the protocol and host is ignored) and saving the bit after the ?product_id=

It then redirects to the new URL using the saved item as part of the new URL.

HTH.

This thread is closed