Gotcha... that’s 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 that’s 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 don’t 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 it’s 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

Reply via email to