Just like how we are able to rename node to home, where site.com/node becomes site.com/home. Is it possible to rename (with the forward slash) node/ to page/ for example?

So that it shows page/67567 instead of node/56757 throught out.

Comments

vm’s picture

enable the path.module
create url aliases that rewrite the paths you want.

example

alias node == page
alias node/add == page/add ............................ so on so forth

more information on the path.module in the handbooks under core modules -> path

_____________________________________________________________________
Confusious says:
"Those who seek drupal answers should use drupal search!" : )

jason342’s picture

It doesn't work that way, since I have my node = home, yet I don't see home/794234 or home/add as you pointed out.

That's why I asked if node/ would work, since the node by itself is not doing that.

Ideally, you'd change node/ to page/ then you wouldn't need to input anything in path again when creating new pages, as it should look, site.com/page/34534 replacing site.com/node/45345345

vm’s picture

It doesn't work that way, meaning the way you are asking for it to work.

as it states right on the url aliasing screen

Use a relative path and don't add a trailing slash or the URL alias won't work.

Thus node/ won't work at all, because it has a trailing slash

So again ........ you have to alias each part of the path to generate the urls you are asking for. (granted, you won't be able to alias every single path. see notes at bottom)

node == page
node/add == page/add
node/add/blog == page/add/blog

see a demo here where I've done this already using "content" instead of "page"

node == content
node/add == content/add
node/add/blog == content/add/blog

my site information removed.

click on create content link, notice path
click on blog entry, notice path
submit a test blog entry, notice node path

Now , if you wanted to, or I wanted to, We can do this for every default path in Drupal, (There aren't that many, maybe 20 - 30 total). Is it a bit tedious? yep, but as you see, it can certainly be done. Just not done with a single alias.

notes: problem aliases, node/#/edit == the edit path, and we can't alias this. same with node/#/outline and node/#/tracker

That being said, we can alias about 50% of the paths, with url aliases but not all.

The only way I can think to try and alias them all would possibly be with a .htaccess rewrite rule & off hand, I don't have it at my finger tips.
_____________________________________________________________________
Confusious says:
"Those who seek drupal answers should use drupal search!" : )

jason342’s picture

Great minds think alike! Well not my mind really, since you beat me to it already. That looks good, but that does seem like tedious work as you said.

I didn't know about the trailing slash. So then is it possible to have a trailing slash for 'existing path' ?

If yes then this might be achieved, say, node/3344 = content3344. Although it looks tacky without the slash, but just wondering if 'existing path' accepts trailing slash?

vm’s picture

whether path is existing or not, you can't add a trailing slash.

I don't think it will work that way either. content#### (you've removed the slash entirely in your example)
The only way to do something like that would be to url alias every single node to remove the slash from the path. If that would even work. I've not played with pathauto.module and the token.module lately, but you may want to look into those with regards to changing paths and bulk updating them. Both of those modules have come a LONG way through the life of Drupal 5.

_____________________________________________________________________
Confusious says:
"Those who seek drupal answers should use drupal search!" : )

jason342’s picture

Why do it for every node, I mean if URL aliases switch every node/ to 'content' then once is all needed, no?

node/ to content

?

(if existing path accepts trailing slash that is?)

PS. I’ve played around with pathauto.module in the past, it does everything one wants. It's great. I was just wondering if this can be achieved through the core.

vm’s picture

in your example you show a trailing slash "removed" content#####

your question is a hypothetical question, for which I tried to give a realistic answer. The answer to your question is no. path.module doesn't accept url's with a trailing slash.

Ideally what you are asking for is "wildcards" to be allowed in path, much like you can set block visibility on paths. Ex: blog/*. Which drupal does not offer with the path.module.

either way, I don't hack core files, so I can't be sure how you would do so in core, or if it's even feasible as it may throw off the entire file system since everything is set relative to insure modularity.

_____________________________________________________________________
Confusious says:
"Those who seek drupal answers should use drupal search!" : )

trailerparkopera’s picture

But it's an interesting problem. I can think of one quick and dirty way to do it, but it would involve touching the entire Drupal install, plus any module you migh want to install -- not a nice way to go about it.

I don't have a good solution for you.

trailerparkopera’s picture

I forgot about pathauto last night. I suspect this is what you are looking for.

Krazna’s picture

I have pathauto in use which creates a little bit of head ache for me.
When i disable pathauto module, the phenomenon below disappears so i am quite certain that it would the reason:

Use a relative path and don't add a trailing slash or the URL alias won't work.

How should we solve this ? For now what happens is that when we use zzz/index.html we get the normal functioning view but with
mysite/example only without the trailing slash (mysite/example/) it prints out every child node in order of published time. Embarrasing.

I have tried several .htaccess redirect attempts since i only have few places (less than 10) where i need to have this fixed.

So how to do it ?

need to have

mysite/example -> mysite/example/index.html