I'm moving a site from EE to Craft. All is well but the redirects from the old URLs to the new do not work.

I have tried:

The only thing I can think of is that Craft is somehow getting ahead of these solutions and running with the 404.

Any assistance would be appreciated.


I wrote the Retour plugin; it will definitely work. However it only kicks in after 404 error is thrown by Craft. So if some route resolves to the URL in question, it won't kick in (because, by definition, it is then not a 404)

  • If I understand this correctly then, if any part of the original URL matches a any route in Craft then this won't work. So if I have a route in Craft for "products" and the original EE URL is domain.com/index.php **products**/lipstick/red and redirects to Craft URL domain.com **products**/makeup/face/lipstick it will not work. Correct? – Wonko Jul 14 '17 at 13:55
  • No, it would have to match the full route (URI) for it to not throw a 404. Something is wrong on your end I think – andrew.welch Jul 15 '17 at 3:09
  • OK. It could have been something as innocuous as having a trailing slash on the URL and "exact match" selected. In any case, I did switch things over to where "products" doesn't exist and all seems to be well. But looking back, it probably was exact match and something that trailing slash. – Wonko Jul 15 '17 at 5:31

I would put your redirects at server level if you can (.htaccess), because you don't necessarily want Craft processing all that traffic when it doesn't need to.

If you put your rule after the Craft rule in your .htaccess it will never fire as everything is routed through index.php before that.

Another potential issue is that Craft inconveniently rename the .htaccess to be htaccess so I would check that too just in case.

If you want to add what you're trying to do in your .htaccess in your answer that would help.

  • Strongly disagree with this. First, if we care about performance, we should not be using .htacess at all, as it is parsed at runtime: Stop using .htaccess files! No, really. Secondly, my Retour plugin adds very little overhead, it operates only after a 404 has been thrown by Craft. – andrew.welch Jul 15 '17 at 3:05
  • Strongly disagree with your comment, if you are getting a shit tonne of traffic, all those requests will go through Craft when it doesn't need to. If performance is what you care about, why put the request through php at all? – joep Jul 15 '17 at 9:28
  • We want to optimize for the majority case, which is normal requests. Adding to (or even using) .htaccess slows down the majority case of normal requests. Exceptions, such as 404s, rarely happen comparatively speaking, so slowing the entire site down for exceptional cases doesn't make sense imo. At the very least, if you care about performance, eschew .htaccess entirely as per the article, and put them in your server config. Handling exceptions, well, exceptionally, is more effective still imo – andrew.welch Jul 16 '17 at 13:36
  • In your article, you conclude that it only effects performance when you get into high traffic. High traffic going through both Apache and PHP (and Craft) is probably more of a performance hit for the server and will use more server resources to process a redirect. Until there is further evidence to suggest that it is a benefit RE: time taken, memory & cpu levels on an isolated server doing an identical crawl/task, I don't think you are in a position to say that it is definitely better. – joep Aug 2 '17 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.