As a developer or tester you sometimes need to use multiple logins at the same time. A browser can usually handle only one login session at a time. When you loggin in another tab or window, the other session is destroyed. Logging in and out over and over again can be very annoying. The solution is simple: use subdomains!
When the same website is accessible via multiple domain names or subdomains, you can use a different login for each of those domains. Say you have three logins (users “joe” and “anna” and administrator “admin”), and you want to see if the users can hide information from other users, while the administrator can access everything. You might use the following setup:
- Login “joe” uses: joe.uruguru.net
- Login “anna” uses: anna.uruguru.net
- Login “admin” uses: admin.uruguru.net
- Guest visitor uses: uruguru.net
NB: the subdomains used here don’t exist and don’t work!
All three subdomains point to the same website: uruguru.net, but for the browser this doesn’t matter. Whether the websites behind the domain name are the same or not, for the browser they are different, and each one can have it’s own session.
yourdomain.com
Sometimes (or many times) you can’t change DNS settings for a domain name. If you have your own domain name, and can handle DNS settings yourself, you can create subdomains of your own domain (sub1.yourdomain.com), and point those to the to be tested domain. It may turn out that this doesn’t work, but well, it was worth a try.
Many times a given websites works with both www.domainname.com and domainname.com. In those cases you can probably use two logins at the same time. There is no guarantee that this works, but give it a try and see for yourself.
localhost
When developing on a local machine, you can change the hosts file. Sometimes this is not possible or you don’t want to do this for various reasons. One solution is to point subdomains of your own domain to 127.0.0.1.
- local1.uruguru.net >> 127.0.0.1
- local2.uruguru.net >> 127.0.0.1
- local3.uruguru.net >> 127.0.0.1
- etc
NB: these subdomains don’t exist and don’t work!
This might seem stupid, but sometimes it comes in handy. With one action you can create multiple subdomains, and they always point to the machine you’re working on.
Of course, when somebody else knows about these addresses, they can use them too. If they do so, the IP-address points to their machine, not yours, because 127.0.0.1 or localhost is always the machine you’re working on. (If you don’t understand what I say here, then you better forget it alltogether.)
Using these local subdomains you can have multiple sessions on your local machine without the need to change your hosts file.