Vassilis Barzokas
Vassilis Barzokas

Reputation: 3232

Point cPanel subdomain to CodeIgniter controller

I have a CodeIgniter controller which looks like this:

mysite.com/controller

What I want to do is to be able to call this controller from a subdomain, e.g.:

subdomain.mysite.com

When I create a subdomain through cPanel, it creates the folder subdomain to the root of my site and it cannot point to the CI controller instead.

I tried with different .htaccess combinations found here on SO and other sites, with no luck.

I also read that there is the option of creating 2 separate CI applications, but I would not like to do that.

My .htaccess currently has options only for removing index.php from url:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

Upvotes: 0

Views: 867

Answers (1)

Hugo B.
Hugo B.

Reputation: 503

Set your base_url in application/config/config.php to this subdomain an then set your default_controller in application/config/routes.php.

Upvotes: 0

Related Questions