Subdomain is a domain which is a part of a larger domain. For example, 'sub.example.com' is subdomain of 'example.com' domain.
Questions tagged [subdomain]
5761 questions
704
votes
7 answers
Share cookies between subdomain and domain
I have two questions. I understand that if I specify the domain as .example.com (with the leading dot) in the cookie that all subdomains can share a cookie.
Can subdomain.example.com access a cookie created in example.com (without the www…

adam0101
- 29,096
- 21
- 96
- 174
276
votes
8 answers
How do I get a list of all subdomains of a domain?
I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative Nameserver with the following option:
dig @ns1.foo.example example.com axfr
But this never works. Has anyone a better idea/approach

cgicgi
- 2,879
- 2
- 18
- 5
275
votes
12 answers
Can (domain name) subdomains have an underscore "_" in it?
Can subdomains (domain names) have underscore _ in them?

Daniel Kivatinos
- 24,088
- 23
- 61
- 81
266
votes
33 answers
"Could not get any response" response when using postman with subdomain
I am using postman to test an API I have, all is good when the request does not contain sub-domain, however when I add a sub-domain to URL I am getting this response.
Could not get any response
There was an error connecting to…

Yahya Hussein
- 8,767
- 15
- 58
- 114
176
votes
12 answers
How to let PHP to create subdomain automatically for each user?
How do I create subdomain like http://user.mywebsite.example? Do I have to access .htaccess somehow? Is it actually simply possible to create it via pure PHP code or I need to use some external script-server side language?
To those who answered:…

Skuta
- 5,830
- 27
- 60
- 68
171
votes
9 answers
When should one use a 'www' subdomain?
When browsing through the internet for the last few years, I'm seeing more and more pages getting rid of the 'www' subdomain.
Are there any good reasons to use or not to use the 'www' subdomain?

Xn0vv3r
- 17,766
- 13
- 58
- 65
150
votes
8 answers
Use localStorage across subdomains
I'm replacing cookies with localStorage on browsers that can support it (anyone but IE). The problem is site.example and www.site.example store their own separate localStorage objects. I believe www is considered a subdomain (a stupid decision if…

JoJo
- 19,587
- 34
- 106
- 162
126
votes
9 answers
Create subdomains on the fly with .htaccess (PHP)
I am looking to create a system which on signup will create a subdomain on my website for the users account area.
e.g. johndoe.website.example
I think it would be something to do with the .htaccess file and possibly redirecting to another location…

Ben McRae
- 3,551
- 13
- 36
- 31
124
votes
29 answers
PHP function to get the subdomain of a URL
Is there a function in PHP to get the name of the subdomain?
In the following example I would like to get the "en" part of the URL:
en.example.com

Damiano
- 1,249
- 2
- 9
- 3
124
votes
3 answers
Subdomain on different host
I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up.
Here are the specifics:
Domain is registered with GoDaddy.
Nameservers are pointing to DiscountASP.net where ASP.NET app…

mattsmith321
- 6,793
- 5
- 28
- 18
120
votes
5 answers
How to put wildcard entry into /etc/hosts?
I recently wanted to point all subdomains for a test domain, let's say example.com to the localhost. Is there a way to point all requests on *.example.com to resolve to 127.0.0.1

aamir
- 3,753
- 4
- 23
- 34
113
votes
18 answers
Get the subdomain from a URL
Getting the subdomain from a URL sounds easy at first.
http://www.domain.example
Scan for the first period then return whatever came after the "http://" ...
Then you remember
http://super.duper.domain.example
Oh. So then you think, okay, find the…

jb.
- 9,987
- 12
- 39
- 38
101
votes
4 answers
Should I delete the cgi-bin folder in a subdomain I just created?
Using cpanel on my hosting account, I created a subdomain - e.g. www.clothing.mysite.com
A cgi-bin folder was automatically created in the directory for clothing.mysite.com. Do I need it? I'm only using the subdomain to install wordpress on it. I…

Margo
- 1,013
- 2
- 7
- 4
93
votes
2 answers
Rails routing to handle multiple domains on single application
I've been unable to find a workable solution to this problem, despite several similar questions here and elsewhere. It seems likely that this question hasn't been answered for Rails 3, so here goes:
I have an application that currently allows users…

Aaron Vegh
- 5,217
- 7
- 48
- 75
88
votes
9 answers
.htaccess rewrite subdomain to directory
Is it possible to use .htaccess to rewrite a sub domain to a directory?
Example:
http://sub.domain.example/
shows the content of
http://domain.example/subdomains/sub/

Erik Djupvik
- 1,187
- 1
- 10
- 13