Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-05-30
5
Medium Priority
?
3,075 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 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 2000 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

963 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