How to set external URL link to Magento admin menu

How to set external URL link to Magento admin menu

September 22, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to set external URL link to Magento admin menu

When developing custom modules in Magento, you may need to link menu items to external URLs from within your adminhtml.xml file. However, you might encounter issues where Magento automatically prefixes the domain name before the external URL.

By default, when you define an external URL using the <url> helper tag in adminhtml.xml, Magento inserts the current domain name before the provided URL. This behavior is intended to ensure that all links are relative to the site’s base URL for consistency across different environments.

For instance, if your code looks like this:

<action><url helper="https://externalurl.com"/></action>

The actual output in the admin menu will be something like:

http://mydomainname.com/https://externalurl.com

This automatic prefixing of the domain name can be problematic when you specifically want to link to an external resource without this prefix.

Solving the Problem: Using Absolute URLs

To set only the external URL in your menu item, you need to use an absolute URL instead. An absolute URL includes both the protocol (http:// or https://) and the domain name of the website.

Here’s how you can achieve this:

  1. Define the Absolute URL: Ensure that the URL you provide is already prefixed with https:// (or http://, depending on whether the external site uses SSL).

  2. Use Direct URL Tag: Instead of using the <url> helper, use the direct <action> tag and include the absolute URL inside quotes.

Here’s an example:

<action><url type="direct">https://externalurl.com</url></action>

In this code:

  • We’re using the type="direct" attribute to tell Magento that we’re providing a raw URL.
  • The value of the <url> tag is enclosed in quotes and contains the absolute external URL.

If you want the link to open in a new browser tab, you need to add an additional attribute to your menu item.

Magento allows you to set the target attribute on the <action> node. The value _blank will ensure that the link opens in a new window:

<action><url type="direct" target="_blank">https://externalurl.com</url></action>

Conclusion

Setting an external URL for a Magento admin menu item requires understanding how to work with absolute URLs and using the direct <url> tag instead of a helper. By following these steps, you can ensure that your links open externally as intended.

Remember, consistency is key in development. If you’re creating multiple modules, it’s good practice to maintain this approach across all of them for code readability and ease of maintenance.

For more advanced Magento module development techniques, check out the comprehensive guides available on LaravelCompany. These resources provide in-depth coverage of topics like creating custom modules, working with the Magento 2 architecture, and integrating third-party services.

Extensions Admin Configuration Errors

Our network