UPDATE: The challenge has been solved!
Would you like a free muffin? Here is how you can get one:
If you are the first person to solve our challenge, we will have a muffin delivered to you from your nearest coffee shop. Of course, we prefer that you live in a place that is reasonably accessible to coffee shops.
You don’t have to be a programmer to solve this. If you have a working knowledge of English, you should be able to spot the line. But we will briefly dive into the problem for those who might like to know more.
If you want to redirect a path in Drupal, it is as easy as adding an entry at
admin/config/search/redirect/add. But someone might ask, “how do you redirect a file in Drupal?” Well, it depends. If you have removed or renamed a file in the files directory, you can add a redirect from the old file path to the new. That would work because the old file would no longer exist. If the file was not removed or renamed, however, the redirect will not work. There is a way around that, though. That is where the module redirect_file comes in. Here is the problem statement from the module’s README file:
We ran into a project that had a Drupal instance with a legacy directory at the
root of the site. The old URL path was shared through email so the hierarchy was kept in place for historical reasons. As the files in that directory become outdated, the content administrator wanted to create a redirect to an updated version of the file uploaded in the files directory.
We discovered that the redirect_file module had to be modified to work for the scenario described above. Look at the code snippet below and see if you can identify the reason why it wouldn’t work for our case out-of-the-box.
Hint: Pay attention to the inline comments.
Tweet your answer at @blencorp.
Your muffin will be waiting!