Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7627157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:25:20+00:00 2026-05-31T05:25:20+00:00

Under the site-enabled www.test.com , I have multiple VirtualHost configurations. ServerName varies (eg. test1.com

  • 0

Under the site-enabled http://www.test.com, I have multiple VirtualHost configurations. ServerName varies (eg. test1.com, test2.com, test3.com) but points only into one DocumentRoot.

I can detect which server name the user is currently in by using $_SERVER['SERVER_NAME']. However we have a particular page which requires pointing to a specific subdomain. Enabling site-wide cookies is definitely a go for this project.

My concern thus: Is there anyway to have multiple $config['cookie_domain'] in config.php? So I can have this matching idea:

$server_name = $_SERVER['SERVER_NAME'];

if($server_name == "test1.com")
    $config['cookie_domain'] = ".test1.com";
else if($server_name == "test2.com")
    $config['cookie_domain'] = ".test2.com";
... // so on

I even tried adding this into config.php but no luck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:25:21+00:00Added an answer on May 31, 2026 at 5:25 am

    Yes, what you’re doing should work for each individual domain, but the nature of cookies is that they are inherently not cross-domain. You’ll need some additional magic to make cookies (or session data) accessible across multiple top-level domains.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Selenium running under Cruise Control to test our site once a day.
I have the CakePHP stack in /var/www/site from one view under controller A I
I'm running MOSS 2007 and have created a new site under an existing one
My site was under example.com/waha/ . Now I move the site right under the
In my portfolio site I have listed my projects under separate tabs (tab menu).
I have many static images under a directory in my site structure, and I'm
I have a simple test purpose WCF service. I'm trying to host it under
I keep reading that an ASP.NET based web site should have custom errors enabled
I have a SharePoint feature that is activated under 'Site Collection Features' that is
I have installed Windows Server 2008R2x64 under VMWare Workstation, to test installation of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.