1

如何使我的 URL (mysite.com/node/1) 看起来像这样 mysite.com/categoryname/myarticlename.html

我用过Joomla!直到现在,它有一个很好的选择来使用 mod_rewrite 和 .htaccess。

我怎样才能用 Drupal 做到这一点?

这可能吗?

我不知道我是否可以在这里询问这些问题,但如果不能,我将删除此帖子。

提前致谢!

4

1 回答 1

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.

于 2013-07-04T17:00:32.597 回答