Skip to main content
September 10, 2009
Question

301 Redirect Multiple URLS

  • September 10, 2009
  • 1 reply
  • 680 views

I have three separate URLS in my hosting account. Currently I am using a .asp page to peform a response.redirect so that if someone types www.url1.com they go to the index file/pages for that site, and if they type www.url2.cfm they go to the index file/pages for that site. This gives the user perspective that all three sites are separate despite being in only one hosting account.

This is not search engine friendly, but I don't control the IIS and still need to have all 3 redirects to their proper folders so that they act as separate sites.

Is there a SEO friendly way to do handle this? i.e. cfif URL is www.url1.com cflocation /url1/index.cfm

This topic has been closed for replies.

1 reply

September 10, 2009

Also, if there is a better way to do this not using CF, I am open to it. I am just looking for the best way to handle this.

September 11, 2009

I have found a solution. See the example below if it helps...

In your root folder, create an index.cfm file with this code:

<!--- redirect for domainA.com --->
<cfif cgi.http_host CONTAINS "domainA.com">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="http://www.domainA.com/domainA/">
<cfabort>

<!--- redirect for domainB.com --->
<cfelseif cgi.http_host CONTAINS "domainB.com">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="http://www.domainB.com/domainB/">
<cfabort>

<!--- redirect for domainC.com --->
<cfelseif cgi.http_host CONTAINS "domainC.com">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="http://www.domainC.com/domainC/">
<cfabort>

<cfelse>
<!--
this should only be someone accessing the site by IP address, so you can redirect like above, or do something internal for yourself - like list links to the domains - like a quick personal portal for yourself
--->
</cfif>