Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get the ENTIRE URL as seen in the browser without JS?
    text
    copied!<p>I have an application I'm building in ColdFusion, whereby all requests will run through the index.cfm file.</p> <p>I have a .htaccess file that rewrites the URL. So, for example...if I write:</p> <p><a href="http://domain.com/hello/goodbye/howdy" rel="nofollow">http://domain.com/hello/goodbye/howdy</a></p> <p>The actual request always uses index.cfm like so:</p> <p><a href="http://domain.com/index.cfm/hello/goodbye/howdy" rel="nofollow">http://domain.com/index.cfm/hello/goodbye/howdy</a></p> <p>This all works great, but now I'm stuck with how I can grab everything that is in the URL. Not one of the CGI variables don't seem to output the "/hello/goodbye/howdy" part of the URL.</p> <p>I have tried cgi.path_info and cgi.query_string etc to no avail...they're just blank. </p> <p>I need to grab everything that comes after the domain name, and do stuff in CF with it. I know it's possible in JS, but I really need this on the server.</p> <p>Dumping the CGI scope shows me nothing useful in this regard:</p> <pre><code>&lt;cfdump var="#cgi#" /&gt; </code></pre> <p>Here's my htaccess file for reference:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.cfm$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.cfm [L] RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} !^([^\.]+)\.domain\.com RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] &lt;/IfModule&gt; </code></pre> <p>Thanks.</p> <p>EDIT:</p> <p>As an additional note, I've also tried the underlying Java methods like so:</p> <pre><code>&lt;cfdump var="#getPageContext().getRequest().getContextPath()#" /&gt; &lt;cfdump var="#getPageContext().getRequest().getRequestURL()#" /&gt; &lt;cfdump var="#getPageContext().getRequest().getQueryString()#" /&gt; </code></pre> <p>To no success :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload