Skip to content

toitzi/koseven-subdomain

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Koseven Subdomain Module

License

This is a simple Subdomain module for Koseven, which started as a port from jeanmasks sbdomain module for Kohana 3.x

✨ Features

  • Different Routes for diffrent Subdomains

πŸ“„ Configuration

After enabling the module in Kohana::modules, set base_url to an absolute value in your bootstrap:

Kohana::init(array(  
   'base_url'   => 'http://your_domain.com/',  
));

πŸ“‹ Route Examples

Let's say your base_url is "http://example.com".
The following Route will route every request to "http://example.com" and "http://www.example.com":

Route::$default_subdomains = array(Route::SUBDOMAIN_EMPTY, 'www');  
Route::set('default', '(<controller>(/<action>(/<id>)))')  
  ->defaults(array(  
     'controller' => 'welcome',  
     'action'     => 'index',  
  ));

While this Route only routes requests sent to "http://test.example.com" and "http://test2.example.com":

Route::set('subdomain', '(<controller>(/<action>(/<id>)))')  
  ->subdomains(array('test', 'test2'))  
  ->defaults(array(  
     'controller' => 'test',  
     'action'     => 'index',  
  ));

πŸ‘ Special Thanks

Thanks a lot to jeanmask!

The module is maintained by toitzi.

πŸ‘ Contributing

As usual, fork and send pull requests

πŸ”° Getting Help

  • Open issues in this project.

About

Koseven module to define routes by your custom subdomains.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages