How to include subdomains in MVC structure

Since I developed my own framework, and it works great, it’s fast, fast and tested, which can cope with a decent load.

Now I am working on a project that can be described as an online store, where each user will have their own additional domain, where their products will be available for sale.

My framework works by breaking the request URL into / and determining what the controller is, action parameters .. etc.

and it works fine, but what about subdomains?

I changed my reqest object, so when I type, say:

http: //kodi.shop.local/

(I added SeverAlias ​​* .shop.local)

This is what my query object looks like:

DPLS_Request Object
(
    [_request] => Array
        (
            [0] => 
            [1] => 
            [action] => defaultAction
            [controller] => home
        )

    [_params] => Array
        (
        )

    [_rurl:private] => kodi.shop.local
    [_segment] => kodi
    [get_params] => Array
        (
        )

)

_segment - , , , . , , - , , URL-, , : (

... mvc-/ ?

- :

if($this->_request['controller']==''){ 
    $this->_request['controller'] = DEFAULT_CONTROLLER; 
}
if($this->_request['action']==''){
    $this->_request['action'] = DEFAULT_ACTION; 
}

, , , _segment, DEFAULT _SHOP _CONTROLLER, , , "",

http://shop.local/store/ ( "store" )

? " " ?

+3
3

, , , . , Request/Router " , ? ?" .. .

+2

"" , , , , . ( , , crappier )

, locale (en.site.com , fr.site.com ...), " " no .

: rewrite *.store.site.com *.site.com/store/

+1

Source: https://habr.com/ru/post/1702571/


All Articles