Where is this redirect being set? - iis

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

Related

Hybris accelerator electronics site always redirect to https

I am really new to hybris so I just installed the accelebrates followed the wiki page. But when I access the site using the http link
http://electronics.local:9001/yacceleratorstorefront/
it always redirect to
https://electronics.local:9002/yacceleratorstorefront/electronics/en/
I have suspect the get and the server have return 302 Found with the new redirect URL.
Can anyone help to explain what is the settings and why hybris redirect me to https link like this.
It's the accelerator's default behavior to change it, update the file spring-security-config.xml under your store front extension :
<security:intercept-url pattern="/**" requires-channel="https" />
I was able to accomplish this by deleting every instance of
<security:intercept-url pattern="/**" requires-channel="https" />
or simply the
requires-channel="https"
in the places where interceptor was a bit more complex in the same file spring-security-config.xml mentioned by Benoit.
Then, just restarted the platform(no compilation required).
This works but obviously at the cost of removing all https requirements so this should only be used for demonstration purposes.

Redirect Expired HTTPs to HTTP

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

Coldfusion 301 redirect loop (www and non-www point to the same file)

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.

Redirect anything not already redirected with 301 on IIS7

We recently setup a new website on a new domain using WordPress, to replace our old website using flat files. Because of time constraints, we had little time to plan and ended up having someone setup the redirects in IIS Manager.
This means that almost every folder in the old website has something like the following for each page:
<location path="old-file.html">
<system.webServer>
<httpRedirect enabled="true" destination="http://new-domain.com/new-page/" exactDestination="true" childOnly="true" httpResponseStatus="Permanent" />
</system.webServer>
</location>
The problem is that this was a massive site with ~15k pages and only about 1k pages were manually redirected to new URIs. This means we have potentially 14k pages of legacy content (effectively dead URLs, some of it is so old) but we need to it redirect to the root of the new domain.
So almost every folder has a web.config with one instance of the codeblock above for each page redirected, but we need every page that wasn't redirected in this manner to redirect to a fixed location.
Manually configuring isn't an option because of the number of pages. I thought about using a tool to add a line of PHP to handle the redirect to every .php and .html file (PHP had to parse html files on this site for legacy content) but it's far from ideal.
Ideally, there'd be something I could put in the web.config which would say "For any request not already redirected via <location>, redirect it to "http:// domain.com". Even if this meant appending something to the web.config already in each folder, it would save days of work, say if no locations match, then redirect.
I've searched for having multiple locations or wildcards in <location> blocks but doesn't seem possible so I'm not sure what do do here—any help appreciated!
Suggestion: why not you redirect your 404 page to home page of any other you wish to.. if someone lands to any old page that no longer exists should go to 404 so redirect 404 to homepage, common practice in case of ecommerce sites they redirect their discontinued product page to search page. If that helps you can google "redirect 404 to homepage wordpress" there are lots of plugins that would do it, but as IIS you can simply config your web.config.
If the urls are now dead and you dont have replacement content to redirect them to, then the proper response would be to return a 404/410. Redirecting dead urls in bulk to the homepage will be seen by Google as a soft 404. https://support.google.com/webmasters/answer/181708?hl=en

How to set up 301 redirects in Kentico CMS

How would you approach setting up 301 redirects within Kentico CMS (v5.0)?
I want to provide a client with an easy way (ideally through the CMS Desk interface) to set up 301 redirects in a website that has recently be re-implemented on Kentico. For example, I would want to redirect "old-page.cfm" to "new-page.aspx", and ensure that the HTTP response to the original request is 301.
I have an approach that looks like it works, but maybe there is a better way. I configured extensions-less URLs (per Kentico's documentation) and added a new document alias to the "new-page" document, specifying the "old-page" as the URL path and adding ".cfm" to the URL extensions list. Using Fiddler (HTTP Debugging Proxy) tool, it looks like what I want to have happen is happening: the request for "old-page.cfm" is returning a 301, redirecting to the "new-page" document, and returning a 200 response.
Does anyone know if this is a good approach for setting up 301 redirects in Kentico? Is there a better way? Are there any known drawbacks to using extension-less URLs in Kentico?
I think this is a good approach and I'm not aware of any other way to accomplish 301 redirects without doing what your doing. I've used Extension-less URLs in Kentico for awhile now and they work well.
According to a Blog Post (Comment) by the CTO of Kentico:
... there are few new (so far experimental) settings in 4.0 (4.0 ONLY) you can put in the web.config file.
They are:
3) <add key="CMSUsePermanentRedirect" value="true" /> which allows 301 redirection in places where it makes sense, instead of 302 redirection.
2) <add key="CMSRedirectAliasesToMainURL" value="true" /> which you can use for better SEO. It does 301 on every URL which is not main for the document (NodeAliasPath). That should help you for now.
3) <add key="CMSRedirectInvalidCasePages" value="true" /> which goes even further and allows you to restrict the pages only to a specific case variant. When the case is not right, it gets 301 to the right case.
I'm not sure what the status of these are with 5.X, but I'm guessing they either work, or they are now configuration settings somewhere in the Site Manager.
I would install the IIS Rewriter module http://www.iis.net/downloads/microsoft/url-rewrite
Then I would add a rule (permanent = 301) for all the .cfm pages to be processed by a custom handler.
For the customer I have to create a custom table with two columns that holds the relation between the old links and the new links.
That custom handler will then look into the custom table for any matches and then do the correct redirection.
I have implemented it in IIS6 for several clients moving from a php system to kentico using ISAPI Rewrite from Helicon (http://www.helicontech.com/isapi_rewrite/). It uses a .htaccess file at the root of the site. You could make this an edittable page from kentico if you needed to, or updatable from a custom field in page if you needed to, however we just got mapping list from our clients.
I believe you can do the same thing natively in IIS7 with one of the optional plugins.

Resources