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

301 Redirect Multiple URLS

Guest
Sep 10, 2009 Sep 10, 2009

Copy link to clipboard

Copied

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

TOPICS
Advanced techniques

Views

631

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 10, 2009 Sep 10, 2009

Copy link to clipboard

Copied

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.

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 11, 2009 Sep 11, 2009

Copy link to clipboard

Copied

LATEST

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>

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