1

How can I make my URL (mysite.com/node/1) appear like this mysite.com/categoryname/myarticlename.html

I've used Joomla! until now, and it has a great option to use mod_rewrite with .htaccess.

How can I do this with Drupal?

Is this possible?

I don't know if I can ask here about these problems, but if not, I will delete this post.

Thanks in advance!

apaderno
  • 28,547
  • 16
  • 75
  • 90
  • If question is going to like, "is this possible?" or "How can I do this?" and a suggestion was given, at least explain the downvote. I tried to explain that `mysite.com/categoryname/myarticlename.html` would not make sense because there is no reference to the page ID. There could be an article with the exact same name, How will you tell them apart in the rewrite? Withdrawing it then. Good Luck – Panama Jack Jul 04 '13 at 16:59
  • @Pjack The downvote was from me. I meant no offence, but the information in your answer was fundamentally wrong. Drupal has URL alias management built in, and contributed modules can extend the functionality to the nth degree. They provide automatic redirects, canonical URLs, configurable URL collision management and more without touching the code. – Clive Jul 04 '13 at 17:09
  • @Clive it's no problem, hence the withdraw, clearly you're the Drupal guru lol. – Panama Jack Jul 04 '13 at 17:17

1 Answers1

2

Firstly, make sure you have clean URLs properly configured.

Then you've got two options...

  1. To add aliases on a node-by-node basis, go to the node edit form and add it manually (this is built into core), e.g. enter image description here
  2. If you want aliases to be automatically created from properties/fields attached to nodes, install the Pathauto, Token and Entity modules (the last of those contains the Entity Token module). Then go to /admin/config/search/path/patterns, and define some aliases for your various content types. e.g. enter image description here

    When you create content an alias will be automatically created. Depending on the settings you choose, the alias can also be updated from the fresh data when you update a node.

As a bonus you can then install Global redirect which will handle all of the auto-301 redirects for you.

Unless you've got a pretty advanced use case you'll never need to edit the .htaccess file just to provide URL aliases.

Clive
  • 36,918
  • 8
  • 87
  • 113