Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 22nd March 2013, 06:47
briand0713 briand0713 is offline
Junior Member
 
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Redirecting subdomain to a different website

Greetings,

I am having problems trying to figure out how to redirect a subdomain to a different website.

Here's what I want to do:
Redirect:
forum.mydomain.com (hosted by me) -> forum.theirdomain.com (hosted by a different service)

Everytime I setup/edit the 'Subdomain for website' and test it, forum.mydomain.com just directs to mydomain.com

I'm hoping someone could help me set this up. Thanks
Reply With Quote
Sponsored Links
  #2  
Old 23rd March 2013, 18:49
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

What's your ISPConfig version? Do you use Apache or nginx?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 24th March 2013, 18:24
briand0713 briand0713 is offline
Junior Member
 
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
What's your ISPConfig version? Do you use Apache or nginx?
ISPConfig v3 and I use Apache
Reply With Quote
  #4  
Old 25th March 2013, 10:14
Jepso Jepso is offline
Junior Member
 
Join Date: Feb 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is how I did something similar:

Instead of adding subdomain I added A-record to DNS.
When users tries to access forum.mydomain.com DNS points to specific IP where redirects are handled. Behind this IP there is a index.php where I read what site was requested and check from "redirects_db_table" if there is a row for this site. If row for this site was found, I have two ways for redirecting; URL and URL Frame -redirect. Desired method is stored in the same db row. If predefined method is URL, browser will be redirected to forum.theirdomain.com with header('Location: '.$result["target"]);. With URL Frame an iframe is created and target site or url is loaded into it like this: <iframe src="<?= $result["target"]; ?>"></iframe>. In both cases $result["target"] is the forum.theirdomain.com.
Reply With Quote
  #5  
Old 25th March 2013, 13:27
Jepso Jepso is offline
Junior Member
 
Join Date: Feb 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could also create a CNAME record for mydomain.com:
Type: CNAME
Name: forum
Data: forum.theirdomain.com.
Priority: 0

I think you can also use .htaccess file to do the redirect (not sure if this works):
//Rewrite to forum
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} forum.mydomain.com[nc]
RewriteRule (.*) http://forum.theirdomain.com/$1 [r=301,nc,l]

But if you still want to do this by adding subdomain, I guess you could do it like this:
Host: forum
Domain: mydomain.com
Redirect Type: L
Redirect Path: /forumredir/

Now you can create forumredir folder to mydomain.com web directory and create index.php which contains header('Location: http://forum.theirdomain.com');
Reply With Quote
  #6  
Old 3rd April 2013, 06:39
briand0713 briand0713 is offline
Junior Member
 
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tried editting the CNAME to direct to the redirect site (xxx.proboards.com) but it still didn't work.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
subdomain folder under Website basedir qiubosu Installation/Configuration 2 26th December 2010 19:10
How Subdomain works (for documentation) moglia Developers' Forum 7 19th June 2010 22:14
Publishing a Zend project in a subdomain of my website vaio1 General 7 13th June 2010 11:57
website subdomain wildcard support agramajo Tips/Tricks/Mods 2 12th May 2010 02:03
Subdomain, another website Thomas Jensen General 3 20th March 2010 23:32


All times are GMT +2. The time now is 07:01.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.