I was wondering if this is possible, if so how difficult would it be, and has anyone done anything like this?

What I am trying to do is to change the URL from something like this:
http://www.mysite.com/node/view/65

to something like this;
http://www.mysite.com/node/view/my-node-title.html

Basically grabbing the title for the node and adding dashes between the spaces and getting rid of any apostrphies and adding .html to it.

I know this is done through mod_rewrite and I don't want to mess it up before asking people who are more comfortable than i am with Drupal and how nmod_rewrite was constructed for Drupal.

Regards

KC

Comments

kc’s picture

has nobody tried that? or willing to help?

kc

Tom Chance@kdedevelopers.org’s picture

As far as I know, mod_rewrite can't start making database calls, so you'd have to adjust the PHP code so that when mod_rewrite sends "node/view/6" to "index.php?q=node/view/6", you just make sure that the PHP code that picks up the "6" instead picks up the html filename, and makes the necessary database query.

You'll also then have to change the code for all of the generated links so that links point to your kind of link, and not to the numerical link.

Robert Castelo’s picture

When you create a page there is a 'Path Alias' field where you can specify the path for that node as anything you like. Give it a try and see if it's what you where looking for.

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

killes@www.drop.org’s picture

It should also be possibly to create a path.module that automatically sets an alias based on the node title.

kc’s picture

I had never thought about the path alias thing, it is working great for my purposes. "to create a path.module that automatically sets an alias based on the node title" will be an awesome feature because AFAIK Google looks at the URL as well when searching for a keyword.

However this is a little bit more than what I can do myself. Do you guys mind pointing me in the right direction as to which function to modify or what do watch out for and stuff like that, because I am not a PHP programmer. I can modify stuff a bit since I am somewhat familiar with overall object oriented programming concepts.

Thanks alot to all who posted replies to my question. Drupal and Drupal team rocks!

KC

Tom Chance@kdedevelopers.org’s picture

Indeed, such a module would be very handy :)

kc’s picture

I found out this site today, as I was searching for something. This guy is using Drupal I beleive with amazon module or something. Look at his URLs
http://www.bitesizeinc.net/node/view/29220.Tshirts_Iron_on_Patches.html

I wish I new PHP good enough to do stuff like that :-(

My Sites:
powershotblog.com
one-stop-ecommerce.com