• PedanticRobot (unregistered)

    I'll take this wrong solution over the modern standard of not doing anything in the frist place and just letting links rot.

  • (nodebb) in reply to PedanticRobot

    In this particular case, the developers were using Code Igniter, a PHP framework for web apps, which has a routing engine; it would have been trivial to simply direct all the forwarded routes to a controller that just handles the redirects.

  • Sam (unregistered)

    Also there's no exit() after the header() calls, so any other code later in the page will continue to run. I've found a few sites accidentally emitting some tasty page content after they think the client has been redirected.

  • (nodebb)

    When all you have is a 404, everything looks like a nail.

  • (nodebb) in reply to colejohnson66

    Sure, but regardless of it being a wrong-headed solution(1), it's definitely better than doing nothing.

    (1) It might have been a progressive thing. When there are two or three links to redirect, the approach here is much more manageable and less costly at runtime, but I agree that once the call to add the second batch of paths to the switch (hooray for C/C++ style switches that don't allow switch()ing on strings), whoever did it should have started thinking about there being a better way.

    Well, this unfortunate person should have started thinking.

  • (nodebb)

    TRWTF is that the code isn't written as

    switch ($uri) { case "/SOMEURL": case "/SOMEOTHERURL": case "/YETANOTHERURL": // ... THERE ARE 300 of these ... case "/MOREURLS": case "/EVENMOREURLS": $redirect_url="http://www.SOMEWEBSITE.com" . $uri; break; }

    No, wait, the real WTF is that this fscking site has absolutely no instructions on how to format the content of a post.

  • Lurk (unregistered)

    dpm> ... site has absolutely no instructions on how to format the content of a post.

    Instructions!? C'mon. If you're here you're a programmer and we /never/ read instructions, especially not the blokes so why would anyone write instructions? I mean that's almost /documentation/. Now, go away and wash your mouth out with soap for using such nasty language.

  • (nodebb)

    we /never/ read instructions

    Pretty big talk for someone with a browser history full of "https://stackoverflow.com/xxxxxx"

  • Duke of New York (unregistered)

    I'd like to ignite the code, all right.

  • (nodebb)

    We can all agree that the code would have been more elegantly solved by using a gigantic map instead of a gigantic switch case.

    That controller router thing part of a framework, that looks complicated and probably involves having to read some doc or API. Nah, abusing a 404 error handler to return a 301, that's so much easier for later maintenance: the next intern maintaining this won't have to read any docs!

  • (nodebb)

    the real WTF is that this fscking site has absolutely no instructions on how to format the content of a post

    It uses Markdown.

    There you go: now this fscking site has instructions on how to format the content of a post. Just bookmark this comment.

  • (nodebb)

    TRWTF is that the code isn't written as

    switch ($uri) {
                    case "/SOMEURL":
                    case "/SOMEOTHERURL":
                    case "/YETANOTHERURL":
                    // ... THERE ARE 300 of these ...
                    case "/MOREURLS":
                    case "/EVENMOREURLS":
                            $redirect_url="http://www.SOMEWEBSITE.com" .  $uri;
                            break;
    }
    
  • (nodebb) in reply to jeremypnet

    It uses Markdown. There you go: now this fscking site has instructions on how to format the content of a post. Just bookmark this comment.

    uh ... yap?? mebbe, sometimes!! I put a comment in the 10/21 post (https://thedailywtf.com/articles/comments/a-percentage-of-refactoring#comment-685669) and I used the dots and blah blah blah because "Surround a block of text with lines starting with three backticks to make it a code block" and THAT is what it came out as. On 10/21. Other days, I have used the three dots thing and it has worked as expected.

    So ... not really "markdown" -- kinda like "marked down for quick sale" turns to "clearance" and eventually "everything must go" versions of this convenience. Then it's back to "markdown" when it feels like it

  • (nodebb)

    ... There are three dots above this line. ... There are three dots above this line, too. Wonder if it will work today

  • (nodebb) in reply to jeremypnet

    ... There are three dots above this line. ... There are three dots above this line, too. Wonder if it will work today

    I guess not?

Leave a comment on “Forward Not Found”

Log In or post as a guest

Replying to comment #685724:

« Return to Article