We help IT Professionals succeed at work.

How to remove the query string from url

Scott Bennett
Is there a way, perhaps using <cfheader>, to reomve the query string from the url that appears on the users address bar.
Watch Question

I dont't think it is possible.
Would it be possible to use session variables, or have a javascript function included in each page to submit a form with hidden fields in order to navigate to the next page. Each link on the site would call the function passing the url to navigate to.

As an alternative, if you just don't want the url string visible in the browsers address bar you could consider making your site into a frameset with a single frame, so regardless of where the user navigates, the address in the bar will always be the root of your site.

If you want to completely hide the url string you will need to manipulate the status bar at the bottom, or the user will see the mouseover addresses on hyper links.
Top Expert 2008

what about this:

----- trim_query.cfm ----

<cfparam name=session.url_id>

<cfif isdefined('url.id')>
  <cfset session.url_id=url.id>
  <cflocation url=trim_query.cfm>

Got the url_query is #session.url_query#

Use the following url.ID:
<li><a href="trim_query.cfm?id=1">1</a>
<li><a href="trim_query.cfm?id=2">2</a>
<li><a href="trim_query.cfm?id=3">3</a>
<li><a href="trim_query.cfm?id=4">4</a>

you could do this for each part of the query_string, or you could save the whole query_string as a session variable, and parse that var in your cfscripts...?


I would have to agree with jamathon on this, you cannot manipulate what is showing in the address bar.

You can hide it (sort of) using frames.

Scott BennettManager Technology


Thanks guys I guess I will go with frames.


Explore More ContentExplore courses, solutions, and other research materials related to this topic.