Alex Wolf
Alex Wolf

Reputation: 111

404 Redirect in Orchard 1.7.2

I recently migrated a site from WordPress to Orchard. We managed to keep most of the URLs the same but there were a few we modified due to changes in information architecture/taxonomy.

We now have a problem in that the old URL's that didn't carry over show up as 404 pages on the new site, as one would expect.

I searched for a plugin that could fix this, but the only one I found dealing specifically specifically with 404's does not seem to work in Orchard 1.7 - it says to add the following code to the Orchard web.config

<customErrors mode="On">
      <error statusCode="404" redirect="/Redirect404/Lookup" />
</customErrors>

More info on plugin here: http://gallery.orchardproject.net/List/Modules/Orchard.Module.Redirect404

Orchard seems to completely ignore this configuration and the controller of the plugin is never hit. I read somewhere that this seems to be a change with Orchard 1.4 and later - that it isn't affected by the CustomErrors element -, is this true?

Basically my question is, is there a way to get this functionality/plugin working in Orchard 1.7.2? If not, how can I handle 404 redirects of old URL's to their new URLs?

Thanks!

Upvotes: 0

Views: 502

Answers (3)

hook
hook

Reputation: 1004

The problem is that Orchard 1.7.2 uses ActionFilters to handle the 404s, and not the <customErrors> element in the web.config. One way to solve this is to use your own ActionFilter to handle the redirects.

Here is a blog post I wrote on the subject: http://www.bluesphereinc.com/blog/handling-301-redirects-in-orchard

Upvotes: 1

Hazza
Hazza

Reputation: 6581

I believe what you want to do is enable the Alias UI feature, which is part of core, then add in your old paths and point them to your new paths

Here is a fairly decent overview of the feature, although I think it is fairly self explanatory and you should be fine :) http://www.davidhayden.me/blog/whats-new-in-orchard-1.4

Upvotes: 0

Bertrand Le Roy
Bertrand Le Roy

Reputation: 17814

Do not use 404 to handle permanent redirects. Those can be set-up either through URL rewrite from web.config (better solution), or using the Rewrite Rules that you can find on the gallery.

Upvotes: 0

Related Questions