Solved

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

Posted on 2013-05-30
5
2,988 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

628 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