1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DNS and .htaccess setup?

Discussion in 'Computers, Games, Electronics etc' started by DarkHand, Aug 24, 2012.

  1. DarkHand

    DarkHand Senior Member VIP

    Messages:
    5,117
    Likes Received:
    241
    Joined:
    Sep 30, 2002
    Location:
    Chicago, IL
    So here's what I'm trying to do:

    I have two physical servers: one for file and forum hosting, one for Minecraft. domain.com goes to the forum server, mc.domain.com goes to the minecraft server (which also hosts a few other services like a live mapping system, Mumble, etc).

    The problem is that people entering mc.domain.com into their browsers are sent to the minecraft server's root web index. I plan to just redirect the Minecraft server to point to the forum again, but I also need that web index to access all my administrative functions.

    So I'd like to point another subdomain to that root directory, say admin.domain.com.

    How can I point mc.domain.com to the forum server while also pointing admin.domain.com to the minecraft root web directory listing? If I write an index.html to redirect to the forum server, how do I get admin.domain.com to show the directory listing?
     
  2. Briansol

    Briansol Admins Admin VIP

    Messages:
    21,456
    Likes Received:
    2,117
    Joined:
    Nov 18, 2007
    Location:
    CT
    sub.domains.com just point to physical/folders/ on the filesystem via A records or cnames. Think of them as shortcuts.

    So you can just create a new admin pointer to the place you want it to be.

    And if you need a list of files, and all you see is a white page, you need to use the Options +Indexes directive at the top of the htaccess
     
  3. DarkHand

    DarkHand Senior Member VIP

    Messages:
    5,117
    Likes Received:
    241
    Joined:
    Sep 30, 2002
    Location:
    Chicago, IL
    That's just it... the directory I want admin.domain.com to list out is the same directory I need to put a redirect in to get mc.domain.com to get back to the forums.

    So if I stick something like:

    Code:
    <meta HTTP-EQUIV="REFRESH" content="0; url=http://domain.com/index.html">
    in the index.html of the root directory, mc.domain.com will redirect as it should. But how can I get admin.domain.com to list that same directory's contents if there's now an index.html file in there redirecting people?

    I feel like I'm over-complicating this somehow.
     
    Last edited: Aug 24, 2012
  4. Briansol

    Briansol Admins Admin VIP

    Messages:
    21,456
    Likes Received:
    2,117
    Joined:
    Nov 18, 2007
    Location:
    CT
    Yeah, you can't do it with a meta tag. You need to do it on the actual htaccess file.

    then delete the index file so it loads the actual dir index.
     
  5. DarkHand

    DarkHand Senior Member VIP

    Messages:
    5,117
    Likes Received:
    241
    Joined:
    Sep 30, 2002
    Location:
    Chicago, IL
    Ah ha... Can I redirect to a separate site from within the htaccess file, depending on the referring subdomain? I was thinking I was limited to local directories.

    Then it's just a matter of redirecting everything that comes in from the mc subdomain, and for the admin subdomain, send straight to the directory (with no index.html).

    EDIT: Google to the rescue... Looks like I need to read up on the Rewrite engine. Something like:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mc\.domain\.com$
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
    EDIT EDIT: That's for Apache... I'm running Hiawatha on the game server (smaller footprint) and it has its own rewrite format... Looks doable though!
     
    Last edited: Aug 24, 2012
  6. Briansol

    Briansol Admins Admin VIP

    Messages:
    21,456
    Likes Received:
    2,117
    Joined:
    Nov 18, 2007
    Location:
    CT
    never even heard of that. if you want small and good, nginx is the way to go
     
Verification:
Draft saved Draft deleted

Share This Page