Solved

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

Posted on 2013-05-30
5
2,813 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
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Robert Saylor
Comment Utility
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
Comment Utility
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 6

Accepted Solution

by:
Robert Saylor earned 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to count occurrences of each item in an array.

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now