Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

301 redirect with application .cfm question

Status
Not open for further replies.

besnette1

Technical User
Jun 19, 2001
9
0
0
Hello,
I am using a 301 redirect that I have in my application.cfm file. However, the 301 redirects all "non www" pages to the top-level "www" page i.e I am wondering if anyone knows a good way to modify my code (below) so, if you are on, for example, widgets.com/product-view.cfm?productID=111, it would take it to the full URL, with the i.e. and not back to the top level URL Thank you in advance if anyone has a suggestion, and the code is as follows:

<!--- grab the browsers URL, set to "domain" --->
<cfset domain = cgi.http_host>
<!--- drops the http:// from the URL --->
<cfif findNoCase(" domain)>
<cfset domain = replaceNoCase(domain, " "")>
</cfif>

<!--- 301 redirect to of site, cgi.http_host gives you
--->
<!--- Performs like competitor, this 301 doesn't work on metro pages just like
competitor doesn't --->
<!--- This has tested OK, just like competitor --->
<!--- You can not use widgetURL below. When testing: clear the cache if not
redirecting --->
<cfif domain NEQ " >
<!--- below find out if before the . there is widgets and not a
subdomain or ad id --->
<cfset nonwwws = listGetAt(domain, 1, ".")>
<cfif nonwwws EQ "widgets">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value=" </cfif>
</cfif>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top