Solved

How to redirect/remap subdomain to IP + port (not DNS!)

Posted on 2013-05-30
5
2,931 Views
Last Modified: 2013-10-10
I have a subdomain and I want to point it to a Teamspeak server.
I don't want to do this with a DNS entry.

My possibilities (if any of them can do what I want):
- .htaccess
- PHP redirect
- HTML redirect
- Plesk admin panel

Issue:
The target is Teamspeak, a URL usually looks like this:
ts3server://1.2.3.4?port=123456
For this I use a TSDNS service from the Teamspaek service provider, I can access the server alternativley via
1234.some.domain.com


Questions:
- I want to use the domain ts.mydomain.com to connect to our teamspeak server
- How can I get this working please without changing a DNS entry?
- when using .htaccess, where do I have to places this file? (currently no -htaccess is used, the server runs with Plesk though)
0
Comment
Question by:Smoerble
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 7

Expert Comment

by:Robert Saylor
ID: 39207531
Simplest method create the index.php or index.html file for the sub domain and use a meta refresh tag.

However, a CNAME DNS entry would be the cleanest approach.
0
 

Author Comment

by:Smoerble
ID: 39207556
CNAME is not possbile for me (small hoster and he's not reachable the next days ;)).

I am looking for working HTML or PHP codes, because it seems to me, that the ones I am trying are somehow buggy.

Example HTML:
<META HTTP-EQUIV="refresh" CONTENT="0;URL=1234.some.domain.com">

Open in new window

I assume, this doesn't work, as the TS client (software) is not redirected when accessing HTML code. Not sure about this though.

Example: PHP:
<?php
header('Location: 1234.some.domain.com');
?>

Open in new window

Gives error 500 in a browser (works as designed I think) but not working with TS client software.
0
 
LVL 7

Accepted Solution

by:
Robert Saylor earned 500 total points
ID: 39207576
create a filename called:

.htaccess

And place it in the document web root of the sub domain's directory. Note: On Windows you will have to call it htaccess then use FTP to upload the file. Then using FTP rename the file to .htaccess

Now in the .htaccess insert the following: Note: You will need to make sure rewrite is supported in apache. Most come with it now. It's been a while since I have had to re-compile apache on Plesk.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ts\.mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.ts\.mydomain\.com$
RewriteRule ^(.*)$ "ts3server\:\/\/1\.2\.3\.4\?port\=123456\/$1" [R=301,L]

Open in new window

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question