Forum Moderators: phranque

Message Too Old, No Replies

htaccess rewrite?

         

Bloodmorphed

12:11 am on Sep 23, 2015 (gmt 0)

10+ Year Member



I'm trying to get server.mydomain.dx.am to point to a game server I have. So it would point to IP:PORT

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?xyz\.abc\.dx\.am
RewriteRule (.*) http://000.000.000.000:5569/$1 [R=301,L]

This is what I have so far. OF course IP and Port are not the real ones. Unfortunately it does not work, as I expected it to. I'm quite out of my depth when it comes to htaccess coding. Especially as I have never done it before. Any help would be much appreciated, and if you could, please explain why it works like it does? I like learning why things work the way they do, thanks!

[edited by: Ocean10000 at 2:52 am (utc) on Sep 23, 2015]
[edit reason] broke unintenial links [/edit]

lucy24

4:52 am on Sep 23, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm confused. Are you looking for an (external) redirect or an (internal) rewrite? The opening sentence seems to be talking about yet a third issue: pointing DNS to some particular physical location. You're not talking about proxying from one hostname to another, are you? That's not something that can be done in htaccess.

explain why it works like it does

This is a little difficult, since you have not actually explained how it does work. It is probably better to backtrack and explain in English exactly what you're trying to do.

Bloodmorphed

4:02 pm on Sep 23, 2015 (gmt 0)

10+ Year Member



a hosted domain name should point to a IP:PORT, the DNS manager only makes it point to a IP and not a PORT.

domain.com needs to point to 123.123.123.123:5569 That is what I need. (I'm trying to make a webhosst domain point to my minecraft server.)

lucy24

6:34 pm on Sep 23, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The rule you gave in your first post is an external redirect (R flag). It sounds as if you're looking at an internal rewrite involving the [P] flag. But the real question is: if it's your own server, why are you talking about htaccess? This is a config-file situation; I doubt it can be made to work in htaccess.

Bloodmorphed

8:51 pm on Sep 23, 2015 (gmt 0)

10+ Year Member



It's what the webhost told me to do, but gave me absolutely no way to do it. They gave me a link that pretty much showed me this method. It is NOT my server, I'm buying a webserver from award space. If it doesn't support no redirecting to port that is fine, adding the port to the end of the address is not a huge deal. But it just looks tacky.

They have a htaccess generator which is absolutely useless for what I am in need of, so I am assuming it supports some of it.

Secondly I have TWO servers.
1 is a webhost from the mentioned company above, and the second is a minecraft server, on VERY different servers. Neither of which have a config to magically make this happen... Although I wish it did.

whitespace

11:51 pm on Sep 23, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



Since I assume your domain.name is already pointing to the correct IP address (in DNS) then I would have thought you need an external redirect to port 5569 if not already at that port (ie. port 80).

Yes, your users will see the port number in the address bar, but unless you mess around with proxying the request in your server config (as lucy24 has suggested) then I don't see how you can hide the port number?