title: Subdomains leading to Codeigniter Controllers?
body: <p>This seems like a common request, but I haven't been able to find definitive instructions on doing something like this.</p>
  
  <p>I'd like a subdomain to trigger a certain controller on my CI installation. For example:</p>
  
  <blockquote>
    <p><strong>students.mysite.com</strong> : would open <strong>mysite.com/students</strong> (technically: <strong>mysite.com/index.php/students</strong>. <em>controller:</em> <strong>students</strong>)</p>
    
    <p><strong>teachers.mysite.com</strong> : would open <strong>mysite.com/teachers</strong></p>
  </blockquote>
  
  <p>While preserving the subdomain when traversing deeper. For example:</p>
  
  <blockquote>
    <p><strong>students.mysite.com/help</strong> : would open <strong>mysite.com/students/help</strong> (<em>controller</em>: <strong>students()</strong>, <em>method</em>: <strong>help()</strong>)</p>
    
    <p><strong>students.mysite.com/help/contact</strong> : 
    would open <strong>mysite.com/students/help/contact</strong> (<em>controller</em>: <strong>students()</strong>, <em>method</em>: <strong>help()</strong>, <em>argument</em>: <strong>"contact"</strong>)</p>
    
    <p><strong>students.mysite.com/help/contact/email</strong> : 
    would open <strong>mysite.com/students/help/contact</strong> (<em>controller</em>: <strong>students()</strong>, <em>method</em>: <strong>help()</strong>, <em>arguments</em>: <strong>"contact", "email"</strong>)</p>
  </blockquote>
  
  <p>I realize that <strong>something.mysite.com</strong> right now returns an error. So I figure:</p>
  
  <p><strong>Step 1</strong> would be allowing <strong>anything.mysite.com</strong> to return the root (mysite.com/index.php)</p>
  
  <p><strong>Step 2</strong> would be reading the subdomain and calling that controller</p>
  
  <p><strong>Step 3</strong> would be reading the first argument after the first "/" and calling that method of the controller, and passing the remaining url parts as arguments</p>
  
  <p>I guess really I'm stumped at <strong>Step 1</strong>. I'm on a shared hosting account, is this something I can do via <strong>CPanel</strong>? I tried adding a subdomain for <strong>*.mysite.com</strong> without any luck (unless I just needed to wait longer for propogation, but I feel the chances are higher that I got it wrong). </p>
  
  <p>Back on my home WAMP installation, I'd change up httpd.conf, right? Can I acheive this effect without modifying that file (since I probably can't, since I'm shared using webhostinghub.com)</p>
  
  <p>Phew, thanks for your time!
  - Keith</p>