Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top