Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current page URL in coldfusion ? I am getting home_page_URL/index.cfm while fetching current page URL

I am using below code to get current page URL in coldfusion :-

host = structKeyExists(cgi,'http_host') ? cgi.http_host  : '';
req_url = 'https://' & host &  cgi.script_name;

But in req_url parameter I am getting host_name/index.cfm instead of current page URL. I am getting actual URL in referrer. Please let me know how to get current page URL in coldfusion.

like image 999
Khushboo Avatar asked Jul 17 '17 06:07

Khushboo


1 Answers

Protocol = #getPageContext().getRequest().getScheme()#;
Domain = #cgi.server_name#;
Template = #cgi.script_name#;
Variables = #cgi.query_string#;

So for example:

Canonical = '#getPageContext().getRequest().getScheme()#://#cgi.server_name#/#cgi.script_name#?#cgi.query_string#';
like image 103
Jules Avatar answered Nov 19 '22 03:11

Jules