Hi guys. I've been wrestling with fancy URLs in Drigg and Drupal, and have finally found a smooth, site-wide solution.
My problems began when I realized the following:
- "Action" requests on URL aliases don't work. Eg: /some-category/a-scoop-title/edit
- The current method that Drigg uses for storing and translating scoop URL aliases is incompatible with modules that use the standard Drupal URL aliases.
- Search engines will find duplicate content because scoops, stories, pages, etc are accessible from 2 locations: the original URL (Eg: /node/123), and the URL alias (Eg: /some-category/a-scoop-title).
As it turns out, the solution to the problems above is quite easy.
Rather than putting rewrite functions in settings.php , one should install and configure the following modules:
- Pathauto: This will automatically generate "clean URL" aliases for new nodes. Eg: /some-category/a-scoop-title
- URL Alter: This is needed by the Sub-Path URL Aliasing module.
- Sub-Path URL Aliasing: This will allow "action" requests to URL aliases. Eg: /some-category/a-scoop-title/edit
And if you care about SEO, the Global Redirect module will prevent duplicate content by redirecting URLs such as /node/123 to the node's corresponding URL alias.
What do you think?
Nick
SoftCom, Inc.
http://softcom.com
Comments
Comment #1
nickhoffman commentedBTW, the Token module is required by the Pathauto module.
Comment #2
nickhoffman commentedBTW, in my original post,
means that you should not put the contents of sites/all/modules/drigg/custom_url_rewrite_function.php into settings.php . Instead, you rely upon the listed modules to provide URL aliasing functionality.
Comment #3
mercmobily commentedHi,
There are reasons why I ended up opting for the global aliasing.
Amongst them:
1) If a note changes its category, I want to be able to still reach that node. Right now, it doesn't _actually_ matter which category the node is in -- it will still be found regardless
2) If a node is in an "unrecognised" section, it will be given "All" which is nice
3) It doesn't require configuration. I can tell new users who are not used to Drupal "It works". Any other way requires both installing and configuring external modules.
Now, as of your problems:
* "Action" requests on URL aliases don't work. Eg: /some-category/a-scoop-title/edit
...? Are you sure? I am asking the question because right now that's exactly what should happen -- and what happens in every site I manage...
* The current method that Drigg uses for storing and translating scoop URL aliases is incompatible with modules that use the standard Drupal URL aliases.
This is true.
* Search engines will find duplicate content because scoops, stories, pages, etc are accessible from 2 locations: the original URL (Eg: /node/123), and the URL alias (Eg: /some-category/a-scoop-title).
This is another non-problem: with "my" method, /node/123 is _never_ _ever_ _ever_ linked from _anywhere_ on your site. So, Google (or any search engine) has no way to get to it.
I think I would much rather leave it the way things are right now, and leave people who know Drupal to make an informed decision if they want something more drupal-ish in terms of aliasing.
Bye!
Merc.