简体   繁体   English

拆分 Drupal 的节点 url

[英]Breaking up Drupal's node url

I would like to break up the url variable in Drupal 6 so I can place a directory name between the $base_url and the rest of the path.我想分解 Drupal 6 中的 url 变量,这样我就可以在 $base_url 和路径的 rest 之间放置一个目录名称。 Any ideas as to how I could do this?关于我如何做到这一点的任何想法?

Thanks, Jane谢谢,简

Well, it sounds like you already know the the $base_url, so the part you need is the internal path, which you can retrieve with $path = arg();好吧,听起来您已经知道 $base_url,所以您需要的部分是内部路径,您可以使用$path = arg();检索它. .

However, I don't know what you hope to accomplish by doing this.但是,我不知道您希望通过这样做来实现什么。 Suppose you have a drupal URL like this:假设你有一个 drupal URL 像这样:

http://www.example.com/node/76

That's actually an alias for THIS url:这实际上是这个 url 的别名:

http://www.example.com/index.php?q=node/76

The node/76 part is the internal drupal path, and the .htaccess file in the root folder cuts out the index.php?q= bit for a cleaner url. The node/76 part is the internal drupal path, and the .htaccess file in the root folder cuts out the index.php?q= bit for a cleaner url.

So if you construct an URL like this:所以如果你像这样构造一个 URL :

http://www.example.com/directory/node/76

It will actually be pointing at:它实际上将指向:

http://www.example.com/index.php?q=directory/node/76

Which will then fail, because Drupal will try to treat directory/node/76 as an internal Drupal path, and not find it -- so you'll get a 404 error.然后会失败,因为 Drupal 会尝试将目录/节点/76 视为内部 Drupal 路径,但找不到它 - 所以你会收到 404 错误。

What are you trying to do?你想做什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM