I just ran into a weird scenario that took me a while to figure out. It's not path redirect's fault, but it would be nice if path redirect could warn users about this and make it easy for them to resolve it.
Steps to reproduce:
1. Create a url alias for Contact-Us to feedback using the core path.module
2. Decide you want to use core contact module instead - disable feedback module, enable contact module
3. Using path_redirect, create a path redirect from "Contact-Us" to "contact"
Expected results:
When you visit example.com/Contact-Us you will be redirected to example.com/contact
Actual results:
Path module gets in the way and serves a Page Not Found - 404.
To resolve this, simple remove the url alias of Contact-Us to feedback. But how do you know that's what needs to be done...?
So, when users visit the admin/build/path_redirect I propose
1) that the row for the alias which has this problem is changed to red
2) that a link is added under "Operations" that says "Edit/Delete path alias"
3) A drupal_set_message is displayed at the top of the page saying something like "One or more of your redirects will not work because the "From" value is defined as an Alias in the URL Aliases system. Redirects affected by this are highlighted in the table below."
Thoughts?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | path_redirect-5.x-1.x_pathexists_2.patch | 2.52 KB | HorsePunchKid |
Comments
Comment #1
HorsePunchKid commentedI may be trying to solve too many problems with this idea, but what you describe sounds very similar to that scenario.
What I presume is happening is that path_redirect is not actually saving the path
Contact-Usin the database; it's saving the path that that resolves to viadrupal_get_normal_path($path). But you never are told that fact, and so when you change what that resolves to later, problems arise.So what I would ask is that you try out this patch, bearing in mind the comment(s) in reply to it. (And I would appreciate your input on said comments!) I suspect the patch will solve this problem, though maybe I can dig a little deeper into this particular case.
Comment #2
HorsePunchKid commentedHere's a patch that implements part of your idea, in particular, adding the information about the path alias to the admin table. I think coloring the row is unnecessary: The existence of the edit/delete links is enough to make it stick out.
Comment #3
HorsePunchKid commentedI think the backend issues that led to these confusing situations have been more or less solved. The message you suggested in your third point wouldn't quite be accurate anymore: You can redirect from an existing alias. But a warning message after saving, "The redirect you created overrides an existing path alias. (edit)", would probably still be useful in addition to the patch above.
The real question is whether there's still any demand for this. If not, I'll postpone it.
Comment #4
dave reidD5 is no longer supported.