By narunet on
I recently just found the URL rewriter module in drupal. I was wondering if there is a way that I can get it to make a new rewrite when I make a new story. Like automatically rewriting node/23 to /story/title_of_story.html.
Help will be very appretiated, thanks.
Comments
You need two modules
You need two modules to do this:
- path, this is part of the standard Drupal core. Just enable it.
- pathauto, this is a contributed module.
Just enable both, and configure pathauto to your liking
You can make nodes automatically be:
/category/title-words-here, or
/category/yyyy/mm/dd/title-words-here.html ...etc.
Enjoy
--
Consulting: 2bits.com
Personal: Baheyeldin.com
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
That's nice, but...
how about:
- story/node-title
- book/node-title
- forum/node-title
So depending on the node-type instead of the taxonomy structure..
It does not do it
pathauto does not seem to do that out of the box.
I can't find it in cvs.drupal.org for some reason, but I checked my 4.5 version, and it seems adding node type is relatively straightforward.
Oh, and it does the taxonomy hierarchy too. Using [catpath] instead of just [cat] does that.
--
Consulting: 2bits.com
Personal: Baheyeldin.com
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
conf_url_rewrite
Pathauto doesn't do this to date (afaik), so you have two options if you want aliasing based on node-type:
Since this is a relatively simple aliasing operation, I would suggest that using conf_url_rewrite() is the easiest way to do it.
Jeremy Epstein - GreenAsh
Jeremy Epstein - GreenAsh
The problem is that I don't
The problem is that I don't know how i can use the $node->type inside the conf_url_rewrite() function...
Could you tellme that Jaza?
Pathauto patch to do what you want
I patched pathauto so you can have different paths for each node type. I also added [nid] and [user] as place holders. The patch is at:
http://drupal.org/node/20094
Thanks
JJ