This module is built to avoid 404 (page not found) error. This is done by automatically redirecting to the page with the most similar alias, compared to the one entered via URL.

http://drupal.org/sandbox/hardcoding/1266394
git clone http://git.drupal.org/sandbox/hardcoding/1266394.git avoid404

Tested on Drupal 7.7

Manual reviews of other projects:

Comments

hardcoding’s picture

Status: Needs review » Needs work
hardcoding’s picture

Status: Needs work » Needs review

just solved the conflicts with the locale module, if enabled

pillarsdotnet’s picture

interesting approach. I'm tempted to install it on my website just to see how long it takes to respond to a 404, on a site with *lots* of path aliases.

pillarsdotnet’s picture

Status: Needs review » Needs work

You need a README.txt file, especially if there is anything that needs to be done for installation other than visiting the modules page.

You need to delete the .svn directory from the git repository.

Dunno if it's possible with a sandbox, but your branch should be "7.x-1.x" rather than "master".

You need to run everything through Coder review if you haven't already.

Consider renaming your files/functions to "avoid404" instead of "avoid_404" (i.e. lose the underscore) This is a suggestion not a requirement. Even if someone created a module called "avoid", I doubt we'll ever have any hooks called "404" so probably there's no possibility of namespace clashing.

You need an avoid_404.install (or avoid404.install) file to delete your module-specific variables when your module gets uninstalled. See hook_uninstall().

Probably you should consider integrating with the Redirect module. (This is another suggestion.)

I'd be curious to know what "hoechste" means in English.

Yup; I can see you have not run Coder review, because you have trailing spaces.

The avoid_404_getRedirectAlias() function should be renamed to avoid_404_get_redirect_alias(). Drupal coding standards reserves the use of MixedUpperAndLowerCase for class and method names. Ordinary functions should use the underscore as a word delimiter.

Your files have DOS line endings. You need to convert them to Unix line endings, or else coder will spit out some really confusing error messages.

Remove the ; $Id$ and the version = 0.1 lines from your avoid_404.info file.

(attempting to actually install and test the module now...)

It would be nice (another suggestion) if there was a "select all" option under "Menus to be considered".

(trying to visit a nonexistent page...)

Yup; your module definitely conflicts with the Redirect module.

(Temporarily disabling the latter for testing.)

Okay, I have a page at http://pillars.net/lyrics/rejoice

I tried to visit http://pillars.net/lyrics/rejoiced

But I got a 404 "Page not found" instead.

So... needs work. Too bad, because I'd really like to test things out on a real website.

So it would appear that your module has other conflicts with my site, as well.

hardcoding’s picture

thanks for your effort. i will take a look at the module again when i have some spare time.

i find your idea interesting to integrate this module into the redirect module. should not be too difficult and would avoid the conflict.

misc’s picture

The applicant has been contacted to ask if the application is abandoned.

After ten weeks with a status of needs work: the applicant may be contacted by a reviewer to determine whether the application was indeed abandoned. The action taken by the reviewer should be documented in the project application issue.

http://drupal.org/node/894256

misc’s picture

Status: Needs work » Closed (won't fix)

The application has been closed. If you would like to reopen it, you are free to do so.
See http://drupal.org/node/894256#abandonedtwoweekscontact

hardcoding’s picture

sorry for not responding to your enuqiry. i have this project in mind, but unfortunately i have had no spare time over the past few weeks/months. thank you for beeing after this anyway..

hardcoding’s picture

Status: Closed (won't fix) » Needs review

fixed the problems from #4
hope someone feel free for testing

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxhardcoding1266394git

We 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.

hardcoding’s picture

Status: Needs work » Needs review

corrected errors which code sniffer found

hardcoding’s picture

Title: Avoid 404 » [D7] Avoid 404

changed title

eriknewby’s picture

Status: Needs review » Needs work

2 minor code change suggestions in avoid404.module:

hardcoding’s picture

Status: Needs work » Needs review

thanks for that.
i changed the code in these lines.
drupal_substr makes sense for me because of the unknown url.

thomas_rendleman’s picture

Tested D7.22
Looks good.
Code looks good.
The only thing I would add is in the README.txt because currently there is no text in that file.

hardcoding’s picture

Thank you for testing. :)

I filled the README.txt with text. Hope this was the last change.

musicalvegan0’s picture

Status: Needs review » Needs work

When I installed the module, I was not able to access the configuration page even though I am in the administrator role. You should implement hook_permission() so the permissions for this module are assignable to users and roles.

Otherwise, the rest of the code looks good to me. Good job!

hardcoding’s picture

Status: Needs work » Needs review

Hi musicalvegan0,

first of all thank you. i reproduced the bug. there was a remainder in my code. So only user 1 had access.
I implemented your feature request, so now you can give permission for each user role to access the administration page of avoid404.

musicalvegan0’s picture

Looks good! As far as I can tell, all you need to do now is participate in the Review Bonus program. Good luck.

musicalvegan0’s picture

Issue summary: View changes

changed git url

hardcoding’s picture

Issue tags: +PAreview: review bonus

added "PAReview: review bonus" tag

hardcoding’s picture

Issue summary: View changes

Reviews of other projects

a.milkovsky’s picture

I can suggest you can remove "[D7]" from module name at http://drupal.org/sandbox/hardcoding/1266394.
D7 prefix in title is neccessary only in issues queue for project applications

hardcoding’s picture

you are right, i changed it. thanks :)

kriboogh’s picture

Just tested this and works as stated. Nice, i think this module can really enhance the user experience.

Maybe a small optimisation would be to try to put all functions not needed directly in a separate file which you include only when going to do avoid404 specific stuff. I think from hook_init you only need 'avoid404_page_exists' -> 'avoid404_build_path' -> 'avoid404_get_active_languages'.
Then in your true condition, include the extra functions to do avoid404_goto

How about a hook to let other modules add their own list of extra aliases. Just a thought.

regards,

hardcoding’s picture

Hi kriboogh,

thanks for your suggestions. I created 2 new files. avoid404.inc and avoid404.api.php.
You wrote a good point. I added an hook to let other modules add their aliases.

Hope this was the last optimisation. :)

mpv’s picture

Have you looked into Search 404? I think the functionality of your module can be replicated by it, since it has options to show the first search result instead of the results page when a 404 is reached. I haven't really tested yours, so I might be wrong.

You should ensure your project is not a duplication as suggested in the project application checklist, and please if it is not a duplication add a comment in your project page explaining the differences between both modules.

hardcoding’s picture

Hi mpv,

thanks for your search. I updated my project page.

Here an explanation of the difference between these 2 modules:

Search 404 performs a search on the keywords in the URL, e.g. if a user goes to http://example.com/does/not/exist, this module will do a search for "does not exist" and shows the result of the search instead of the 404 page. Search 404 performs the search in the content.

Avoid 404 performs a search on the alias in the URL, if a user goes to http://example.com/mynode1 and the alias "mynode1" is not set but "mynode" is set, this module will redirect to this most similar alias.

hardcoding’s picture

Issue summary: View changes

Reviews of other projects

klausi’s picture

Assigned: Unassigned » dave reid
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

manual review:

  1. avoid404_get_selected_menu_names(): you could use drupal_map_assoc() instead of the loop?
  2. avoid404_init(): hook_init() is bad because it runs on every single page request. I would rather suggest that you create your own hook_menu() entry and set the site_404 variable to that path. That way your callback will only run if an actual 404 was encountered. And you can move the original path that was in site_404 to another variable and invoke that page if there is not enough similarity with your matching attempts.
  3. avoid404_admin_settings_submit(): since you are using system_settings_form() in the form builder anyway that function is not needed and can be removed.
  4. avoid404_page_exists(): please document the return value with @return. Shouldn't you return booleans, i.e. TRUE instead fo "1"?

But that are not critical application blockers, so I guess this is RTBC. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to Dave Reid as he might have time to take a final look at this.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

no objections for more than a week, so ...

Thanks for your contribution, hardcoding!

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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

removed automated review copies