Public
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
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

 

Valued Contributor

The final code ended up looking like this...

 

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

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.