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 9313031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:46:48+00:00 2026-06-19T01:46:48+00:00

I have a domain and a subdomain which I need both to recognise a

  • 0

I have a domain and a subdomain which I need both to recognise a cookie set by the main domain. On http://www.mydomain.com I set the cookie with Javascript like so:

var d = new Date();
d.setDate(d.getDate() + 30);
var c = "all; expires=" + d.toUTCString() + "; path=/;domain=mydomain.com";
document.cookie = "cookies=" + c;

In the PHP I use a simple if (isset($_COOKIE['cookies'])) ... This works on http://www.mydomain.com but it doesn’t work on sub.mydomain.com.

Any suggestions? Do I have to call the cookie within PHP differently?

  • 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-06-19T01:46:49+00:00Added an answer on June 19, 2026 at 1:46 am
    var d = new Date();
    d.setDate(d.getDate() + 30);
    var c = "all; expires=" + d.toUTCString() + "; path=/;domain=.mydomain.com";
    document.cookie = "cookies=" + c;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a subdomain i need to keep in tact: www.sub.domain.com I also
I have a domain foo.com on server bar. I have a subdomain api.foo.com which
I have 2 Domains which i want to forward. Example http://www.domain.com http://doma.in I want
I have domain site.com and there is subdomain sub.site.com Once you open sub.site.com you
Actually I have a domain - domainone.com I have created a subdomain cname of
If I have domain name example.com , and if I set an A record
I have domain somedomain.net which is linked to some IP 123.45.67.89 I need to
I have a domain and also a subdomain which points via dns to the
I have both my CSS files and my Font files under the main domain,
I currently need to have 2 subdomains under the same domain under SSL. Both

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.