Score:2

How to automatically generate two aliases for the same node?

kr flag

I am working on a Drupal website. I need to automatically generate 2 url aliases for the same node on the website. I have tried installing Pathauto but it lets me generate only 1 alias when a new page is created. Is it possible to have it automatically create 2 aliases when the page is created?

Do we do this via the module itself or can we have this done by code?

Thanks

in flag
You could create one alias, and then one redirect to that alias. Not sure about automatic though.
No Sssweat avatar
ua flag
Who are you trying to fool? What makes you think this is a good idea? This is bad for SEO by the way.
in flag
I agree with No Sssweat. This sounds like a solution that should be reconsidered. Are you able to share the reason why you think you need two aliases? If you absolutely must have two separate URLs, then I think a Controller would suit your needs.
jbarrio avatar
cn flag
I agree with my colleagues that this is not a good idea unless you really have a good reason, but just trying to help, you could generate a second alias upon a hook_node_presave or hook_node_insert.
RitikaDesai avatar
kr flag
@jbarrio Can you please explain why this is not a good idea?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.