subhankar
subhankar

Reputation:

301 Redirect Causing Loop Error

I need to redirect my site from, say:

to

In this application, index.cfm is my default page (set in IIS). When I try a 301 redirect, I am getting a redirect loop error. The whole app is in ColdFusion. I am updating this setting in IIS on my index.cfm page. Please give some advice on this. Thanks in adv.

Upvotes: 1

Views: 1447

Answers (2)

Richard West
Richard West

Reputation: 2226

So in IIS your default page setup looks for index.cfm? I think you are getting the redirect loop because to the server http://www.foo.com/index.cfm is the same as http://www.foo.com.

It sounds like you are wanting to just hide the "index.cfm" from being displayed to the user?

In this case I don't think that trying to use a 301 redirect is the way to go.

You might want to take a look at IIS 7's URL rewrite feature, and look at Approach #3

Upvotes: 4

victor hugo
victor hugo

Reputation: 35848

Well I don't know coldfusion but you may condition the 301 header output just if the URL used to access the script index.cfm has any character extra on it (just if the request method is GET), this way you'll avoid infinite redirects. Here some pseudocode to explain myself:

if URL is not 'http://www.foo.com' and method is 'GET'
    output header '301 http://www.foo.com/'

Upvotes: 0

Related Questions