RE: How to get the full url requested in cf?
Gotcha... thats basically what I've used for a while ... In a page called app_globals.cfm that is ALWAYS included in every page via application.cfm App_globals.cfm then has a few vars set in it to be used through out the site request.webroot = 'http://#cgi.server_name#'; request.imageroot = '#request.webroot#/images'; etc.. so anywhere and everywhere in the site, links, images and cookies are all referenced or created with #request.webroot# So if you come into the site as www.shop.com you will always be at www.shope.com Same goes for http://shop.com. If thats what you came in on, you'll stay there If you want everyone to be on a non www site at all times: request.webroot = http://#replace(cgi.server_name, 'www.', '')#'; request.imageroot = '#request.webroot#/images'; all links and cookies that are created using request.webroot now will not have www. In them If you DO want www... just change request.webroot to.. request.webroot = http://www.#replace(cgi.server_name, 'www.', '')#'; so it will always have 'www.' That takes care of linking everything up in the site and pulling images from the same place (www or not www) You then need to make sure no matter where the user comes in, that they either have or dont have www (whichever you want) Try this in your application.cfm cfif listfirst(cgi.server_name, 'www', '.') url has www in it... Stay or redirect? cfelse url does NOT have www in it... Stay or redirect? /cfif To redirect them, just use... cflocation url=#request.webroot#/#cgi.script_name#?#cgi_query_string# addtoken=yes/no If its the home page, they may end up somewhere like http://myshop.com/? But that wont hurt anything But if they come into your site at the url http://shop.com/somedir/index.cfm?var1=1 And you want them at www.shop... The cflocate would take them to exactly where they are, plus the www http://www.shop.com/somedir/index.cfm?var1=1 -Original Message- From: stylo stylo [mailto:[EMAIL PROTECTED] Sent: Friday, May 06, 2005 10:22 PM To: CF-Talk Subject: Re: How to get the full url requested in cf? I don?t know why you need to know if www is there or not but if you had access to IIS, you could have http://www.shop.com point to a different place than http://shop.com all together There is a stored shop url in the code. Problem is that cookies are being lost between www.shop.com and shop.com when code refers to the shop url variable and cflocates in a few places, or a linkbase variable is set based upon it to use on menus used on various directory levels. I asked my host and they said I would need something like IISrewrite to redirect, or metatags. So I thought to rewrite the request.shopurl variable that is being set, based on their being www or not. Then the cflocate and linkbase will be in line with how people come to the site, with www or not. (Or I can simply relocate all www requests to non www. Maybe better, but wondering about links to the site and search engines.) If you have a better idea, I'm all ears. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205964 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
How to get the full url requested in cf?
I don't want the file system path, I want the full url of the page requested, e.g., http://www.shop.com/index.cfm . (Actually I just need the first part, not even the page, as I only want to know if www was used or not.) How can I get that in a CF variable when the page is requested? ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205829 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: How to get the full url requested in cf?
Try a cfdump of the CGI scope, cgi.http_host might be what you are looking for. -- Hugo Ahlenius - Hugo Ahlenius E-Mail: [EMAIL PROTECTED] Project OfficerPhone:+46 8 230460 UNEP GRID-Arendal Fax: +46 8 230441 Stockholm Office Mobile: +46 733 467111 WWW: http://www.grida.no - | -Original Message- | From: stylo stylo [mailto:[EMAIL PROTECTED] | Sent: Friday, May 06, 2005 12:59 | To: CF-Talk | Subject: How to get the full url requested in cf? | | I don't want the file system path, I want the full url of the page | requested, e.g., http://www.shop.com/index.cfm . | (Actually I just need the first part, not even the page, as I only | want to know if www was used or not.) | | How can I get that in a CF variable when the page is requested? | | ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205830 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: How to get the full url requested in cf?
CGI.HTTP_HOST should give you what you want. -Original Message- From: stylo stylo [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 11:59 To: CF-Talk Subject: How to get the full url requested in cf? I don't want the file system path, I want the full url of the page requested, e.g., http://www.shop.com/index.cfm . (Actually I just need the first part, not even the page, as I only want to know if www was used or not.) How can I get that in a CF variable when the page is requested? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205831 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: How to get the full url requested in cf?
you could use... cfif Find(www., CGI.Server_Name) HTH On 5/6/05, stylo stylo [EMAIL PROTECTED] wrote: I don't want the file system path, I want the full url of the page requested, e.g., http://www.shop.com/index.cfm . (Actually I just need the first part, not even the page, as I only want to know if www was used or not.) How can I get that in a CF variable when the page is requested? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205832 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: How to get the full url requested in cf?
For 'http://www.shop.com/index.cfm?var1=1var2=2' Cgi.server_name would give you the 'www.shop.com' Cgi.script_name would give you the 'index.cfm' Cgi.query_string would give you 'var1=1var2=2' Find() would not ensure that www was the first thing in the name so... cfif listfirst(cgi.server_name, .) is www Then www was in the url. /cfif Or cfif left(cg.server_name, 3) is 'www' Then www was in the url. /cfif I dont know why you need to know if www is there or not but if you had access to IIS, you could have http://www.shop.com point to a different place than http://shop.com all together -Original Message- From: stylo stylo [mailto:[EMAIL PROTECTED] Sent: Friday, May 06, 2005 6:59 AM To: CF-Talk Subject: How to get the full url requested in cf? I don't want the file system path, I want the full url of the page requested, e.g., http://www.shop.com/index.cfm . (Actually I just need the first part, not even the page, as I only want to know if www was used or not.) How can I get that in a CF variable when the page is requested? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205845 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: How to get the full url requested in cf?
On 5/6/05, Robertson-Ravo, Neil (RX) [EMAIL PROTECTED] wrote: CGI.HTTP_HOST should give you what you want. On IIS at least that just gives you the domain name (as in domain.com and not http://domain.com;. To be totally anal and make sure you get the secure string if its a secure connection, you can do this: cfif Len(Trim(CGI.QUERY_STRING)) GT 0 cfset QueryDelim = cfelse cfset QueryDelim = /cfif cfif CGI.HTTPS EQ On cfset HTTPData=https://; cfelse CFSET HTTPData=http://; /cfif cfset CurrPage=HTTPData CGI.SERVER_NAME CGI.PATH_INFO QueryDelim CGI.QUERY_STRING You should also be able to substitute cgi.script_name for cgi.path_info it you want. Same diff. cgi.https is present for sure on IIS. Not sure about other web servers. -- --mattRobertson-- Janitor, MSB Web Systems mysecretbase.com ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205892 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: How to get the full url requested in cf?
HTTP_HOST and SERVER_NAME both work. (On my local setup I thought they didn't because of my local url and missed them.) Thanks! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205937 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: How to get the full url requested in cf?
I don?t know why you need to know if www is there or not but if you had access to IIS, you could have http://www.shop.com point to a different place than http://shop.com all together There is a stored shop url in the code. Problem is that cookies are being lost between www.shop.com and shop.com when code refers to the shop url variable and cflocates in a few places, or a linkbase variable is set based upon it to use on menus used on various directory levels. I asked my host and they said I would need something like IISrewrite to redirect, or metatags. So I thought to rewrite the request.shopurl variable that is being set, based on their being www or not. Then the cflocate and linkbase will be in line with how people come to the site, with www or not. (Or I can simply relocate all www requests to non www. Maybe better, but wondering about links to the site and search engines.) If you have a better idea, I'm all ears. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205938 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54