DNS and .htaccess setup?

We may earn a small commission from affiliate links and paid advertisements. Terms

DarkHand

Senior Member
VIP
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?
 
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
 
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:
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.
 
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.

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:
Back
Top