Copy link to clipboard
Copied
Hello Everyone, I have this code that works great, but there is one little problem.
When user inputs index.cfm it does not forward to plain dynamic.cfm
So it seems to me that i need to modify this code so it can handle at least one more option
The script works very well when user inputs index.cfm?myID=#url.myID then redirects to dynamic.cfm?myID=#url.myID
How could I make it work? Any help greatly appreciated
<!-- File name: index.cfm -->
<cfoutput>
<cfif isDefined("url.myID") AND IsNumeric(url.myID) AND url.myID NEQ 0>
<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="dynamic.cfm?myID=#url.myID#">
</cfif>
</cfoutput>
<cfabort>
You will need to add an "else" clause to your "if" statement. All you are doing is checking for the "myID" parameter and doing nothing if it doesnt exist.
I assume you wont something like this:
...<cfoutput>
<cfheader statuscode="301" statustext="Moved Permanently">
<cfif isDefined("url.myID") AND IsNumeric(url.myID) AND url.myID NEQ 0>
<cfheader name="Location" value="dynamic.cfm?myID=#url.myID#">
<cfelse>
<cfheader name="Location" value="dynamic.cfm">
</cf
Copy link to clipboard
Copied
You will need to add an "else" clause to your "if" statement. All you are doing is checking for the "myID" parameter and doing nothing if it doesnt exist.
I assume you wont something like this:
<cfoutput>
<cfheader statuscode="301" statustext="Moved Permanently">
<cfif isDefined("url.myID") AND IsNumeric(url.myID) AND url.myID NEQ 0>
<cfheader name="Location" value="dynamic.cfm?myID=#url.myID#">
<cfelse>
<cfheader name="Location" value="dynamic.cfm">
</cfif>
</cfoutput>
<cfabort>
Copy link to clipboard
Copied
Hello Haxtbh, Yes it does work thank you so much