2

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

5
  • You could create one alias, and then one redirect to that alias. Not sure about automatic though.
    – Joseph
    Nov 12 '21 at 2:00
  • Who are you trying to fool? What makes you think this is a good idea? This is bad for SEO by the way.
    – No Sssweat
    Nov 12 '21 at 4:29
  • 1
    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.
    – Beau
    Nov 12 '21 at 22:53
  • 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.
    – jbarrio
    Nov 13 '21 at 9:37
  • @jbarrio Can you please explain why this is not a good idea? Nov 15 '21 at 19:41

Browse other questions tagged or ask your own question.