• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to redirect on htttp to https with www redirect of coldfusion mx7?

Guest
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

Hi any one help me  - How to redirect on htttp to https with www redirect of coldfusion mx7?

Views

10.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Sep 14, 2014 Sep 14, 2014

I used below code. its working perfectly. thanks a lot. 

<cfif (CGI.SERVER_NAME EQ "site.com") and (CGI.https NEQ "on")>

<cfheader statuscode="301" statustext="Moved permanently">

<cfheader name="Location" value="https://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

<cfif (CGI.SERVER_NAME EQ "www.site.com") and (CGI.https NEQ "on")>

<cfheader statuscode="301" statustext="Moved permanently">

<cfheader name="Location" value="https://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

<cfif CGI.SERVER_NAME EQ "site.com">

<

...

Votes

Translate

Translate
Community Expert ,
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

To redirect as you describe is a matter for the web server. The settings will therefore depend on whether you use Apache, IIS or Coldfusion's built-in JRun.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

Thanks...

below code i have used but it returns status is 302 redirect. need code for 301 redirect?

<cfif (CGI.SERVER_NAME EQ "site.com") and (CGI.https NEQ "on")>

<cflocation addtoken="no" url="https://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

<cfif (CGI.SERVER_NAME EQ "www.site.com") and (CGI.https NEQ "on")>

<cflocation addtoken="no" url="https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#">

</cfif>

<cfif CGI.SERVER_NAME EQ "site.com">

    <cflocation addtoken="no" url="http://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

In pre-Coldfusion 8, you could use the combination

<cfheader statuscode="301" statustext="Moved Permanently">

<cfheader name="Location" value="https://www.site.com#CGI.SCRIPT_NAME#">

in place of

<cflocation addtoken="no" url="https://www.site.com#CGI.SCRIPT_NAME#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

Hi thanks for your code..

i have used your code  is lines but below error is mentioned...

The page isn't redirecting properly

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

  In this code also i used  but its return 302 redirect.

<!--- Change http to https --->
<cfif IsDefined("CGI.HTTPS")> <!--- Make sure the variable exists --->
<cfif CGI.HTTPS EQ "off" OR CGI.HTTPS IS ""> <!--- Test for a blank value --->
<cflocation addtoken="no" url="https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#">
</cfif>
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

any code for  redirect 301 ( http to https coldfusion mx7) for access all site?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

You should run the following code, and convince yourself that the URLs are accessible, by opening each in a browser:

<cfoutput>

https://www.site.com#CGI.SCRIPT_NAME# <br>

https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME# <br>

http://www.site.com#CGI.SCRIPT_NAME#

</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 14, 2014 Sep 14, 2014

Copy link to clipboard

Copied

Hi BKBK,


Thanks for your code. its perfectly working. thanks a lot. one more doubt. i need how to move image path 301 redirect for http to https  in our whole sites coldfusion mx7?



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2014 Sep 15, 2014

Copy link to clipboard

Copied

LATEST

maniseo wrote:

one more doubt. i need how to move image path 301 redirect for http to https  in our whole sites coldfusion mx7?

I do not quite understand. Do you wish to redirect an image path from HTTP to HTTPS? If so, you could set this up in the web server. What web server do you use?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 14, 2014 Sep 14, 2014

Copy link to clipboard

Copied

I used below code. its working perfectly. thanks a lot. 

<cfif (CGI.SERVER_NAME EQ "site.com") and (CGI.https NEQ "on")>

<cfheader statuscode="301" statustext="Moved permanently">

<cfheader name="Location" value="https://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

<cfif (CGI.SERVER_NAME EQ "www.site.com") and (CGI.https NEQ "on")>

<cfheader statuscode="301" statustext="Moved permanently">

<cfheader name="Location" value="https://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

<cfif CGI.SERVER_NAME EQ "site.com">

<cfheader statuscode="301" statustext="Moved permanently">

<cfheader name="Location" value="http://www.site.com#CGI.SCRIPT_NAME#">

</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2014 Sep 15, 2014

Copy link to clipboard

Copied

Thanks a lot for sharing that. To help others, please mark it as the correct answer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2014 Sep 12, 2014

Copy link to clipboard

Copied

maniseo wrote:

i have used your code  is lines but below error is mentioned...

The page isn't redirecting properly

It is unclear to me what you mean. The cfheader code runs just fine when I test it with

<cfheader statuscode="301" statustext="Moved Permanently">

<cfheader name="Location" value="https://wikidocs.adobe.com/wiki/display/coldfusionen/home">

What happened when you ran the code? Did Coldfusion show you an error message?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation