Redirect 404 allows you to specify any number of servers that should be attempted to be redirected to if a 404 (Page not found) error is encountered. If a user encounters a 404 error, the module iterates through each of the specified servers and if the result is valid (2xx or 3xx status codes), they are redirected to that server while preserving the request URI. If none of the specified servers return valid results, the module can redirect to a search result page (if specified), a static URL page (with no request URI appended), the original/default 404 page within the site (variable site_404), or finally, if none of the attempts above can be used, the body and title of the 404 page may be specified.
Project page link: http://drupal.org/sandbox/vlad.pavlovic/1947784
git repository: git clone http://git.drupal.org/sandbox/vlad.pavlovic/1947784.git redirects_404
Drupal 7 only.
Reviews of other projects
http://drupal.org/node/1948406#comment-7208908
http://drupal.org/node/1946602#comment-7209264
http://drupal.org/node/1948100#comment-7209464
http://drupal.org/node/1936848#comment-7228202
http://drupal.org/node/1956202#comment-7242094
http://drupal.org/node/1957004#comment-7242206
Comments
Comment #1
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #1.0
vlad.pavlovic commentedAdded a review
Comment #1.1
vlad.pavlovic commentedAnother review added.
Comment #2
vlad.pavlovic commentedComment #3
he0x410 commentedHello Vlad!
I like your module and would like introduce it to my team.
Automated review by http://ventral.org/: no errors/warnings :)
Manual review:
Good luck!
Comment #4
klausiManual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #5
vlad.pavlovic commentedFirst and formost, thank you both for taking the time to do the review. I am sorry about the somewhat delayed response, I've been sick the last few days.
I will attempt to answer each issue raised in order that they appear for clarity.
From artem.taranyuk:
1) I have changed the title generation to a title callback function. It just seemed a bit cleaner than to use hook_menu_alter and flush the menu cache. Hope that's ok.
2) CURLOPT_RETURNTRANSFER only determines what to do with curl_exec(). If set to TRUE, curl_exec doesn't output the result of the execution it returns it as a variable, which is what we want. I think that the setting you are refering to is CURLOPT_NOBODY, which uses HEAD and doesn't return any data. This is now moot though, since I switched to using drupal_http_request().
3) Done, changed to drupal_exit(), thanks!
From klausi:
1) The reason I had used cURL was because it is generally faster than stream_socket_clients, specifically when dealing with HEAD requests and because it natively recycles connections. It was a toss-up from day 1, really, some hosts have cURL and forbid stream_socket_clients connections, and others are the opposite way. In the future, if there is interest, I may make the module work with both methods. For the sake of this version and review, I have switched to using drupal_http_request(), as suggested.
2) WOW, my mistake, sorry. Fixed.
3) forgot to push the addition, sorry. Fixed.
4) Removed check_url, you are right, it doesn't belong.
5) Did both (sort of). I sanitized on validation and set the 'restrict access' to TRUE in hook_permissions.
6) Fixed.
Thank you both again for your reviews and subsequent suggestions, they are appreciated.
Comment #5.0
vlad.pavlovic commentedAnother review.
Comment #5.1
vlad.pavlovic commentedAnother review.
Comment #5.2
vlad.pavlovic commentedReview of Taxonomy menu block project application.
Comment #6
vlad.pavlovic commentedAdding PAReview bonus.
Comment #7
SamChez commentedAfter doing some fiddling around with the configuration it looks quite reliable. The only issue I had, and I'm not even sure if it was the fault of the code, was that the redirect speed was lengthy. It got to where I redirected it but took quite a while to get there.
Comment #8
pagolo commentedThe module seems to be useful and working.
If I specify the path of a legacy server, it works but I get this message:
Comment #9
vlad.pavlovic commentedThank you both for the reviews, I appreciate you taking the time to do them.
Samuel, the perceived delay may be caused by the 2 second timeout that I allow for a connection. In the future I might allow the timeout to be configurable. Also, it could be caused by a myriad of other factors, such as server response times and may be out of our hands.
Paolo, you are absolutely right. I have fixed this issue and the notice is now gone.
Thank you both again.
Comment #10
klausimanual review:
But otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Assigning to chx as he might have time to take a final look at this.
Comment #11
vlad.pavlovic commentedThank you for the review Klaus, below are my answers to the issues you have raised:
1) I have removed check_markup() from the redirects_404_settings_validate().
2) I could not use drupal_goto() because $_GET['destination'] is set on 404, and drupal_goto() marks it as an internal path and tries to redirect back to the same page causing a redirect loop. I thought, originally, that setting $options['absolute'] to TRUE would have skipped that, but after looking at common.inc, it turns out that $_GET['destination'] takes precedence. I understand and appreciate why it is that way. I hope it's ok.
3) I simply took out check_markup(). Since we do require high level admin permission, the user modifying the settings page should be trusted.
Thank you again for your review and the RTBC update, you're awesome.
Comment #12
chx commentedThis shouldn't affect RTBC.
Comment #13
vlad.pavlovic commentedThank you for taking the time to look it over Charlie, I appreciate it.
1. You are absolutely right, old habits die hard.
2. I think that the first version I release will include a choice between using cURL (if available) and drupal_http_request. I have not thought about a client-side redirect, but that might become a good choice for people struggling with the other 2, though I have rarely had problems with cURL.
Thank you very much!
Comment #14
chx commentedIt does not matter whether you use drupal_http_request or cURL alas, this is about retarded shared host firewall settings.
Comment #15
vlad.pavlovic commentedI see what you mean. You were talking about firewalls blocking all outbound connections, not that the returning/incoming connection would be an issue, per se.
Comment #16
chx commentedExactly.
Comment #17
vlad.pavlovic commentedThank you again, hope I am not wasting too much of your time.
A client-side/jquery type solution would work, and I will surely add it. I just worry that I will then run into same origin policy issues if I use jQuery.ajax() to check if the path is valid before I redirect.
Comment #18
klausino other objections for more than a week, so ...
Thanks for your contribution, vlad.pavlovic!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #19
vlad.pavlovic commentedThank you all for taking the time to review the project.
It is now located at: http://drupal.org/project/redirect_404 (I took out the 's' from redirects).
Comment #20.0
(not verified) commentedAnother review.