Solved

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

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

920 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

11 Experts available now in Live!

Get 1:1 Help Now