From: L1FEisG00D on
Not being a programmer at all (having adopted the company site from a former
employee) - I wing it and ask for help when I'm stuck. I don't know why my
code isn't working. I have two issues.

<b><u>Issue 1:</u></b>
I'll explain a little so you understandhow our site is set up and works (maybe
it will be obvious to you, but it wasn't to me), and what I needed done and how
I got it to do it. Then I'll explain my problems.

Our site is set up so that everything displays off the index page, all links
to internal pages would have a path like this:
www.mysite.com/index.cfm?action=pagename All the internal pages are stored
off the root folder in a subfolder called <i>includes.</i>

What I needed done:
Telling an end user to type inwww.mysite.com/index.cfm?action=help was asking
for trouble, so I wanted them to be able to enter www.mysite.com/help and have
the help page load.

How it got done
I created a subfolder named help, off my root.
In that subfolder is an index.cfm.
The ONLY code in that index page is <b><cflocation
url="index.cfm?action=page"></b>

Thus, when someone types www.mysite.com/help, the index page from the help
folder redirects them to the help.cfm page (which is stored in the previously
mentioned folder called includes)

Does that make sense?

Well it works for two of my pages (www.mysite.com/help and
www.mysite.com/other)

Now here is the problem
When I start navigating the path file deeper, with subfolders, it doesn't
work. - which is why I'm here.

If you understand what I did to fix redirect, hopefully you can help me
redirect some more pages.

I need the following paths to work:

www.mysite.com/<b>subfolder</b>/help - needs to display the help.cfm file
which is stored in my 'includes' folder
www.mysite.com/<b>subfolder</b>/faq - needs to display the faq.cfm file which
is stored in my 'includes' folder
www.mysite.com/<b>subfolder</b>/updates - needs to display the updates.cfm
file which is stored in my 'includes' folder

I think the 'subfolder' is what is causing my problem.

Inside the subfolder, I have 3 folders, help, faq and updates.
Inside each of those folders I have an index.cfm file, with only the code:
<b><cflocation url="index.cfm?action=page"></b> where <i>page</i> directs to
the help, faq and updates.cfm respectively.

The actual help.cfm, faq.cfm and updates.cfm are located in the 'includes'
folder with all the rest of the pages in my site.

In the 'index.cfm' page that controls my site, I'm <i>guessing</i> the code to
direct to the pages in a sub folder..

In abbreviated format, this is the code that I have on my master index.cfm
page:

<cfcase value ="faq">
<cfinclude template="includes/faq.cfm">
</cfcase>

Is it somewhere in the cfcase value where I'm going to make an edit?

When I had the faq file stored in the subfolder, my cfcase looked like this
(and didn't work):

<cfcase value ="faq">
<cfinclude template="<b>subfolder</b>/faq.cfm">
</cfcase>

<b><u>Issue 2:</u></b>
Now after all THAT ... it doesn't work in Firefox. I get a firefox message
"The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this
address in a way that will never complete."

Thank you.

Can anyone suggest code that will work with Firefox AND IE?

From: SafariTECH on
The primary issue I think you are running into, is that you are making this
overly complicated and tough to manage.

<b>www.mysite.com/subfolder/help</b> = a directory structure.

To begin with, in this scenario, you are going to need new sub directories for
everything you add to the site, which can get really tedious.

The second thing is that the "<b>includes</b>" folder is a sub directory of
the root:
<i><b><site root>/includes</b></i>

When you go to a directory structure such as:
<b>www.mysite.com/subfolder/help</b>
that is really located:
<i><b><site root>/subfolder/help</b></i>

The page in the "<b>help</b>" folder would have to refer back 2 directories
and then forward 1 into the "<b>includes</b>" folder to find the file. Your
current coding does not seem to be doing that. The way they are right now,
(<i>in the initial example</i>) they are trying to load the file from
"<b>includes</b>" as a sub directory of the "<b>help</b>" directory, which
doesn't actually exist.

In the example using <b>index.cfm?page=pagename</b>, when it is located in the
index page that is within that same folder, it is referring to itself and that
is why FF (<i>and I'm surprised not others</i>) are entering into a recurring
loop.

If you really, really, really need to stick with this structure and concept,
you can use the following code for redirection, and it should work in every sub
directory no matter how deep you go (<i>so long as all the inclusion files are
in the "<b>includes</b>" directory and you do not use it in the root index
file</i>).

<b><CFLOCATION addtoken="No" url="/index.cfm?page=pagename"></b>

By using a slash at the beginning of the path, you are telling it to always
start at the root location of the site to find the index file, no matter where
the request initiates from.



Ultimately it would be better (<i>and easier to manage</i>) if you don't
require all the subdirectories.

From: L1FEisG00D on
Thank you for the feedback. I agree this directory structure is dificult to
work with.

I have added many pages to the site and not had to deal with creating
subfolders and working with the directory. I've been able to add the pages,
reference them in the root index page, and create links to those pages from
within the site itself. They work equally well in IE or FF

This directory sturcture only <i>just</i> became an issue when sofware
associated with our site was written directing "HELP" to the
www.mysite.com/subfolder/page ... Since this is hard coded and I can't change
it, I do have to work with it. This path <b>HAS</b> to work. If it were a
matter of creating a hyperlink to a page, the index.cfm?action=page would work
fine.

I edited my code at your suggestion to: <b><CFLOCATION addtoken="no"
url="index.cfm?action=faq"></b> - saved - uploded. Now it doesn't hang
endlessly -but it doesn't show the faq page either.

It shows the root index page, but not the content of the faq page. This leads
me to think that now I have an issue with the code on my root index.

This is what I have now:
<cfcase value="subfolder/faq">
<cfinclude template="/includes/faq.cfm">
</cfcase>

Do I need to change the CFCASE VALUE?
I tried changing it to <cfcase value="/subfolder/faq"> (adding the slash
before the subfolder) and it didn't change anything.

When I try to go to the www.mysite.com/subfolder/faq, this is the url in the
address bar displays:
<b>mysite.com/index.cfm?action=faq</b> so it appears to go to the right place,
but the text that I have on the pagename.cmf is not what shows in the browser
window.


I'm editing in Dreamweaver MX ... and now some of the code is coming up
highlighted as invalid code.
Of the following code, the underlined text is coming up highlighted as invalid:
<u><cfcase value="subfolder/faq"></u>
<cfinclude template="includes/faq.cfm">
<u></cfcase></u>
This is making me crazy. :frown;

<hr>FF is another issue all together that I'll deal with after this all gets
worked out. it is fine with the www.mysite.com/index.cfm?action=pagename
hyperlinks that I have. But as you mentioned, it is stuck in an endless loop
when trying to load my /help page that has the <CFLOCATION url=">


From: r-con on
First, you said you updated your code to:

<CFLOCATION addtoken="no" url="index.cfm?action=faq">

But this still shouldn't work and is not the code offered by SafariTECH.
Either you mistyped it here, or you are indeed still using code that won't work.

What you need to do is use a root relative link in the URL attribute of the
CFLOCATION tag This requires the forward slash character "/" in front of
index.cfm, so the tag looks like

<CFLOCATION addtoken="no" url="/index.cfm?action=faq">

That way, no matter what level of URL subdirectory your browser is pointed to,
it will always find the mysite.com/index.cfm because it looks at the root
level.

Second - I'm not clear on what is being accomplished in the SWITCH CASE you
are using:

<cfcase value="subfolder/faq">
<cfinclude template="includes/faq.cfm">
</cfcase>

However it appears that the CASE in question is not being found true, and
therefore not calling the faq.cfm content from the includes folder, and so the
page just sits.

Perhaps if you post the whole thing, including all between the open and close
CFSWITCH, we can help. I am speculating but I suspect that the switch
expression is looking at the URL variable. Therefore the case value will need
to be the URL variable, not the URL path. If your code says

<cfswitch expression="#URL.action#">

then I am correct. In such case your code should read

<cfcase value="faq">
<cfinclude template="/includes/faq.cfm">
</cfcase>


From: L1FEisG00D on
You're right, I had mistyped the code in my question - my page has the code as:
<b><CFLOCATION addtoken="no" url="/index.cfm?action=faq"></b>

My understanding as to why the switch case is used, is that it directs what
page.cfm displays as the contents in the index page.

There is a <CFCASE VALUE=> </CFCASE> for each and every single page in my
site. If the <CFCASE VALUE= >tags are not on the root index page (or they're
spelled wrong), then the page will not display. What I get then is a blank root
index page.

Here's a sample of the switch case values.

<cfswitch expression="#url.action#">

<cfcase value="home">
<cfinclude template="includes/home2.cfm">
</cfcase>

<cfcase value="shop">
<cfinclude template="includes/shop.cfm">
</cfcase>

<b> <cfcase value="subfolder/faq">
<cfinclude template="/subfolder/faq.cfm">
</cfcase> </b>

</cfswitch>

If I were to manually enter the url as <i>www.mysite.com</i> ... the home page
displays.

If I click on the 'shop' link (the link is on the index.cfm page, thus
displays in <i>every page</i> in the site), the url in the address bar displays
<b>www.mysite.com/index.cfm?action=shop</b>

I can manually enter the url in for every page in the site. For example:
substituting the action=contactus to display the contactus.cfm.

<i> Except for these pages that are in the subfolder directory.</i> Those in
the subfolder directory need to be able to be viewed by typing
<b>www.mysite.com/subfolder/faq</b><i> into the address bar.</i>

The times that I've forgotten to enter the <CFCASE VALUE > on the root index
page (or typoed), say for example for the help page, then the contents of the
help page will not display.

It is as if the browser requires the code to be in the index page for it to
display.

This is exactly what it looks like is happening.

Now, for the 3rd (the bold one) ... I 'guessed' that I would need to include
the directory path to the index page for the redirect to work. Thus, why I
included the subfolder before the actual page name as
<cfcase value="<b>subfolder/</b>faq">
<cfinclude template="/subfolder/faq.cfm">
</cfcase>

Maybe my guess is what is causing the problem. Maybe I can't direct that way.
And if that is the case my question becomes

<b><u>How do I</u> create the code so that someone can enter
<i>www.mysite.com/subfolder/faq</i> as the address, and have the correct page
display?</b>

I <b><u>MUST</u></b> have the path www.mysite.com/subfolder/faq display the
faq.cfm page.

I do appreciate the help you guys are giving me - I'm the first to admit I
don't know the first thing about ColdFusion. As I first posted, I wing it.