APIs & Integrations

aabrenes
Member

Regex thorugh URL Mapping

Trying to setup a Regular Expression Redirect and its not working. ((Content > Content Settings > COS URL Mappings.

Based on my research of Regex, /^tds-download$ start at ^ and end at $ . I have this expression (/^tds-download$) setup as the Redirected URL and the Redirect Destination is the homepage (http://www.mcpolymers.com).

Under the Advanced options, these are checked:

  • Redirected URLs should match original URL’s query string, or lack thereof
  • Original URL is a flexible pattern URL
  • Redirect requests with or without a trailing slash
  • Redirect requests regardless of protocol (either http or https)

However, it still isn’t redirecting if I hit the page directly: http://www.mcpolymers.com/tds-download

Anyone have any insight to this issue?

0 Upvotes
2 Replies 2
aabrenes
Member

Regex thorugh URL Mapping

Thanks for the fast reply!

However this may be tricky…

that tds-download url typically looks like this :http://www.mcpolymers.com/tds-download?pdfUrl=http://inbound.mcpolymers.com/hubfs/Technical_Data_She... (when coming form a product page)… so we want to make sure that only the exact URL (http://www.mcpolymers.com/tds-download) is the one that redirects – and not the ones that have the ?..with all the other stuff with it.

Would your suggestion hold true based on that new information?

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Regex thorugh URL Mapping

Hi @Parker_Web

We do support a type of pattern matching for URL mappings, but our flexible pattern matching does not support regex syntax. You can find more details about setting up flexible pattern URL mappings here:

How do I set up a flexible pattern URL mapping?

Navigate to Content > Content Settings to begin setting up a flexible pattern URL mapping in HubSpot.

If you just need to redirect that one page to the home page of your site, you should be able to do that by using:
/tds-download for the Original URL or path
/ for the Destination URL or path
You would want to use the same options, except you wouldn’t need the flexible pattern URL option checked.

0 Upvotes