Hide / Change Browser URL?

Is there anyway to change the displayed URL for a web page? (like an alias or such like?)

Reason: I have member defined pages on my web site that are called via /fred.cfm?u=123 where 123 is the user's unique id.

this is not very friendly ... so (with the help of EE) I found a great way to enable users to call their user page easily via www.fred.com/username - which wonderfully looks up the username in a table and if exist ... does a simple <cflocation url="/page_blah.cfm?u=#checkMembers.id#" addtoken="no">

all is well ... but for icing on the cake ... i'd like the redirected URL in the browser to show /www.fred.com/username and not www.fred.com/page_blah.cfm?u=123

does this make sense?
any ideas?
Richard
rcbuchananAsked:
Who is Participating?
 
andw928Connect With a Mentor Commented:
What you mean it is not resolved? It is resolved, like I said in my first post:

"You cannot do that without tuning the server. If you are running Coldfusion on Apache web server then you might want to look into Apache's mod_rewrite. The url is: http://httpd.apache.org/docs/mod/mod_rewrite.html"

You cannot do what you want to do without tuning the server. And if you want to tune the server, then there you go I gave you the URL to apache's mod_rewrite to be able to do it.

You cannot edit something in the address bar, if that is what you mean. Once again, the only way to do it would be via mod_rewrite or server url rewrite tools.

And the closest you would get without modifying server settings, would be this: folder/?username. You cannot do: folder/username. Since the server will thing that is a folder, not a file.

If you want to do folder/?username you would do this:

<cflocation url="folder/?#username#" addtoken="no">

Then on folder/index.cfm, you would retrieve the username by doing this:

#cgi.query_string#

Which would give you the #username# part of the URL.
0
 
andw928Commented:
You cannot do that without tuning the server. If you are running Coldfusion on Apache web server then you might want to look into Apache's mod_rewrite. The url is: http://httpd.apache.org/docs/mod/mod_rewrite.html

The best you can do programmatically is something like: index.cfm/username/190 or index.cfm/username/190.html. You can find a tutorial on this over here: http://tutorial90.easycfm.com/


Goodluck!
0
 
rcbuchananAuthor Commented:
Hmm. not sure you understood my question;
is there anyway to modify the displayed url in the brower's address bar?AFTER the page has been loaded.

again - I've successfully managed to translate www.fred.com/gbush into www.fred.com/viewuser.cfm?u=123
I JUST want to change the URL displayed - when www.fred.com/viewuser.cfm?u=123 into www.fred.com/gbush ... like an alias or such like.

Any ideas?
R
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
BugBoysWorldCommented:
that would be defiend as your link.  you wouldnt be able to do www.fred.com/qbush but you could do something like www.fred.com/viewuser.cfm?/qbush or www.fred.com/viewuser.cfm?u=qbush.

you need to see how you are creating the link to viewuser.cfm and change it there. there are other ways to hide the id like using a post a post....
0
 
duroWRXCommented:
Instead of

<cflocation url="/page_blah.cfm?u=#checkMembers.id#" addtoken="no">

Couldn't you do:

<cfinclude template=page_blah.cfm">
<cfexit>
0
 
rcbuchananAuthor Commented:
never mind,
i didn't explain myself properly; so 'no' ... i NEED the ?u=
THAT is the POINT. these are dynamic URLS called after the url is trapped and compared against the user database.

NEVER mind ... i'll stick with my solution as is.

thanks folks but I'll ask for this question to be closed UNRESOLVED>
0
 
rcbuchananAuthor Commented:
have the 500 points.
i'm not looking for a solution any more. my need is not understood on this point.  thank you.
enjoy.

R.
0
 
andw928Commented:
Well, if you want you can re-explain it in even more detail, I can still try to help you if you want. I didn't want to take those 500 points from you like that, but if you give them to me then Thanks dude! I appreciate it!

-Matt

0
 
rcbuchananAuthor Commented:
Thanks PinalDave! Appreciate the thoughtfulness.
No, ... I'll find another track for the answer ...
Good day though! :-)
0
 
pinaldaveCommented:
Okey Rick,
Good day!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.