k6t back
k6t back

Reputation: 85

how to construct URL like these mychoice.domainname.com,

i need to constract URL like these

for eg : My Domain name : www.domainname.com
expecting Output

login as a candidate i need to change it as candidate.domainname.com

login as a recruiter i need to change it as recrutier.domainname.com

can any help, i'm new to Construction user friendly url.even small your suggestion, it ll also help me. ,so don't hesitate to give suggestions.

Upvotes: 0

Views: 88

Answers (3)

aporat
aporat

Reputation: 5932

You can check the $_SERVER['HTTP_HOST'] in your bootstrap and set the default module based on it:

protected function _initModules()
{
    $frontController = Zend_Controller_Front::getInstance();
    $frontController->addModuleDirectory(APPLICATION_PATH . '/modules');
    $frontController->setParam('prefixDefaultModule', true);

    $systemDomainName = 'domainname.com';

    // our api is located at api.domainname.com
    if ( ($_SERVER['HTTP_HOST'] == 'api.' . $systemDomainName)) {
        $frontController->setDefaultModule('api');

        $restRoute = new Zend_Rest_Route($frontController);
        $frontController->getRouter()->addRoute('default', $restRoute);
     } else if ( ($_SERVER['HTTP_HOST'] == 'candidate.' . $systemDomainName)) {
         $frontController->setDefaultModule('candidate');
     }

}

Upvotes: 1

Andrew Landsverk
Andrew Landsverk

Reputation: 673

You need to login to your domain control tool, usually provided by your hosting company, and add a CNAME record, also known as an alias, for your domain that points back to your "A" record in your DNS configuration, usually this also points to "www".

Using GoDaddy as an example, the CNAME record would point to "@" which means it points to your A record.

Upvotes: 0

This is not friendly url. This is sub domain system that manages at domain control panel.

Upvotes: 1

Related Questions