cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Valued Contributor

How do I get the hostname in the url of the current environment?

I have a form and upon submission, it should redirect to a Thank You page.  I do not want to hard-code the base url as we use both staging and production sites.

 

How can I get the hostname from the current environment I'm working in?

I would expect to do something like: ${hostname}/t5/custom/page/page-id/thank-you

2 Replies 2
Lithium Alumni (Retired)

Hi @dustin

Using http.request freemarker context object you should be able to retrieve the request's URL and perform a string matching to extrac the hostname.

 

Nico

 

Highlighted
Valued Contributor

The final code ended up looking like this...

 

https://${http.request.serverName}/t5/custom/page/page-id/support-thank-you