kohana / core

Core system classes from Kohana
http://kohanaframework.org
636 stars 327 forks source link

Support for subdomains #497

Open salyakhov-art opened 10 years ago

salyakhov-art commented 10 years ago
Route::set('admin', '((/(/)))')
    ->subdomains(array('admin'))
    ->defaults(array(
         'controller' => 'welcome',
    ));

Route::set('default', '((/(/)))')
    ->defaults(array(
        'controller' => 'welcome',
    ));

site.com/controller/index // 'default' route admin.site.com/controller/index // 'admin' route

What about the subdomains of the form "sub1.sub2.site.com"? To consider both the subdomain as one or disassemble them?

shadowhand commented 10 years ago

Github strips anything that looks like <html> tags. Please use backtick quotes to format code as code.

kemo commented 10 years ago

Editted; fixed code formatting

neo22s commented 10 years ago

What about the subdomains of the form "sub1.sub2.site.com"? To consider both the subdomain as one or disassemble them?

I will just do:

->subdomains(array('sub1.sub2'))
ghost commented 9 years ago

Also, i think, what if you (Kohana developers & community) realize this feature, will be good, if you show VirtualHost setting example for that site (admin.example.com - subdomain);

piotrbaczek commented 7 years ago

I have my subdomains set in htaccess - I'm using multi-domain kohana application

`#BACKEND RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} (www.)?backend. RewriteRule .\ backend.php/$0 [PT,L]

API

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} (www.)?api. RewriteRule .\ api.php/$0 [PT,L]

USER

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} (www.)?user. RewriteRule .\ user.php/$0 [PT,L]

FRONTEND

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

And each file points to different bootstrap. However currently there is no way to inject subdomain into URL::site