Our clients website SSL expired recently and now the client wants https to redirect to http temporary until his SSL is up again.
Is there a way in ColdFusion or IIS to do this. E.g. https://www.example.com redirect to http://www.example.com
Please help, its hard to find resources regarding this.
While you want to get them back on https as soon as possible, this might work:
Put the following at the start of the onRequestStart method in your application.cfc:
<cfif isBoolean(CGI.server_port_secure) AND CGI.server_port_secure>
<cflocation url="http://www.example.com" addtoken="false" />
</cfif>
You should do it in IIS, not ColdFusion:
http://blogs.msdn.com/b/kaushal/archive/2013/05/23/http-to-https-redirects-on-iis-7-x-and-higher.aspx
Related
I have hosted a website in IIS but the site is always redirecting to Https localhosts eventhough i provided only http protocol port.
but when i browse the site it is redirecting to
https://localhost/
No idea why this site is behaving like this ?
There must be an HTTP redirect rule, click on your site, and then find the URL rewrite component, delete the rules you don’t need, so that no redirection will occur.
I would like all traffic to my site to use https on IIS.
How do I configure a redirect to do that?
(Note: this will be self answered, as there is no correct answer anywhere on this.)
This blog link supposedly answers this question:
However, no-one so far as been able to get it the answer to work, as you end up with an endless loop of a redirect redirecting to a redirect.
So after working with this and resolving it, here is the correct answer:
Install the Http Redirect Feature if it is not already installed.
Create two sites, not one site. The first site is the insecure site which is bound to http only. Do not bind https on this site.
The second site is your secure site. This is bound to https and your security cert.
On the insecure site, add the http redirect: "Redirect requests to this destination: https://example.com" Select status code of Permanent (301).
Test. Any request to http://example.com will be forwarded to https://example.com.
I have searched for this everywhere but all I can find is related to .htaccess files. The server my website is hosted on is not using Apache so I can not use an .htaccess file.
I am trying to send people to the www version of my site whenever they type in the non-www domain. So if user types domain.com it will send them to www.domain.com. The problem is that they both are already pointing to the same coldfusion file.
I have a redirect set up that works but it is a 302 redirect:
<cfif cgi.server_name eq "mydomain.com">
<cfset cgi.server_name="www.mydomain.com"/>
</cfif>
If i change the cfset to:
<cflocation statuscode="301" url="www.mydomain.com"/>
it creates an infinite redirect loop and I get an error page.
I need to use a 301 redirect so that Google will not double index my page and say that I have duplicate content as it sees the www and non-www as two seperate sites even though it points to same file. Also a 301 redirect will transfer link authority from the non-www to the www domain.
To do this in CF you would do something combining your 2 I think.
<cfif cgi.server_name IS 'mydomain.com'>
<cflocation statuscode="301" url="www.mydomain.com"/>
</cfif>
FYI - your code is in error for cflocaiton - cgi.server_name is not an attribute of cflocation.
As stated by others you can do this with your web server. Apache or IIS can both handle this task very easily. In IIS you set up a site with mydomain.com as your host header and set it up specifically as a redirect site to www.mydomain.com. good luck!
If you really want to do it with ColdFusion then try this in the onRequestStart() method of your Application.cfc file...
<cfif cgi.server_name eq "example.com">
<cflocation statuscode="301" url="http://www.example.com" addToken="no">
</cfif>
But as others have said, you're better off redirecting at the web server layer.
I just inherited a new site but messed up the SSL cert by losing the private key.
The url would have been https for anyone using the site meaning right now they are clicking on a broken site, or an SSL error to be more clear.
Is there any way around this for now, ideally just a redirect to a holding page would suit me fine.
I cant redirect to http using htaccess as I think htaccess doesnt even get a chance to kick in at that stage
Thank you
In short: What you want is not possible.
Details: HTTPS is HTTP inside a SSL tunnel. The redirect is done with HTTP. Since you messed up the establishment of the SSL tunnel it will not be able to start with HTTP (inside the non-existing tunnel) and thus cannot do a redirect.
I am trying to figure out where some redirects are being set for a web site I'm managing. It is an IIS server and the application is mainly in cold fusion. I have found with certainty that the IIS settings do not specify any redirects. No cold fusion settings that I've found allow redirects from the server side. There are no '< cflocation >' or header changes in the cold fusion files that would cause this redirect. Finally, there are no redirects in any of the .htaccess files. What other possible causes/locations could there be for a 301 redirect being set?
Thanks!
Redirects can also be done with cfheader:
<cfheader statuscode="301" statustext="Moved permanently" />
<cfheader name="location" value="http://www.mysite.com/new-location-for-content/" />
Or there can be a Javascript redirect as well, something like:
document.location='http://www.mysite.com/new-location-for-content/';
Or there may be a bit of ASP, etc., etc.
More examples here http://www.somacon.com/p145.php