简体   繁体   中英

Drupal 6 custom frontpage by domain

I have a drupal 6 website for a real estate agency. Since each agents have their own url, I want to direct them all to the main website and use a different homepage per domain name (in this case their user profile page which have a view of their properties).

So far I use the init() function of a module to check if the domain is different from the main one and find to which user the domain belong.

I know I could use drupal_goto('users/username') but I would prefert to do it without changing the url. This way the site look more "customize" to the agent rather than a redirect in the main website.

Here is the code of my init() function:

if(!strstr($_SERVER['SERVER_NAME'],'maindomain')){
    //look in profile field id 8 to which user the domain belong
    $value = db_result(db_query("SELECT uid FROM {profile_values} WHERE fid = 8 AND value like '%s'"), $_SERVER['SERVER_NAME']);
    if($value){
        //store the uid in $agent_site for further use
        global $agent_site;
        $agent_site = $value;
        if(drupal_is_front_page()){
            //Do the equivalent of drupal_goto('users/username') without modifying the url
        }
    }
}

Thank you very much for your ideas.

Have you tried the front page module

http://drupal.org/project/front

Or you can also use a splash page

http://drupal.org/project/splash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM