Skip to main content
Participant
May 10, 2006
Question

Get the URI from the address bar

  • May 10, 2006
  • 6 replies
  • 10662 views
In the past I've been able to use CGI.REQUEST_URI to get the URI that is in the address bar. In CF7 i'm not able to use that. My URI does not match directly to a physical file.

I'm using a CFM page to determine which page and with which parameters to display a page.

example: www.example.com/semantic-url/

there isn't a dir for "semantic-url", I'm using .htaccess to direct to a CFM page to redirect (ie. redirect.cfm) in that page i need to be able to get the URI from the address bar.

CGI.REQUEST_URI used to do that. Now it just resolves to redirect.cfm

Any ideas? or Questions if I wasn't clear. Thanks.
    This topic has been closed for replies.

    6 replies

    Inspiring
    May 11, 2006
    Well it'd only be a reference in the .htaccess file - that's only one place to go if it ever needs to change?
    k3nd477Author
    Participant
    May 11, 2006
    What i'm trying to do is decouple the CFM page from the URL to give me total future flexibility. So including a reference to redirect.cfm would not work with that.
    Inspiring
    May 11, 2006
    I believe the problem is that you are using your web server to redirect a request for:

    www.example.com/semantic-url/

    Into a request for:

    www.example.com/redirect.cfm

    So as far as ColdFusion knows, the page being requested is redirect.cfm. You may need to try some other approach to accomplish whatever you're trying to do.
    k3nd477Author
    Participant
    May 11, 2006
    Thanks for your responses. I actually have the redirects working with CF 6 using CGI.REQUEST_URI. The problem is that in CF7 that CGI var isn't present and no other CGI var will show the URI, just the physical path name. I have dumped the CGI variables, they show the page as redirect.cfm.

    Is there a way to do URL redirects that i described above using Application file?
    Inspiring
    May 11, 2006
    Maybe try redirecting www.example.com/semantic-url to www.example.com/redirect.cfm/semantic-url and then trying CGI.PATH_INFO?
    Inspiring
    May 11, 2006
    Might be in PATH_INFO... not sure though; I've not tried that with url-rewrites.
    If not, try dumping the CGI scope and seeing if any of the other values have what you want.