Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When a user signs up (and is verified), he is asked to enter a value for a subdomain which is then stored in the database along with his other credentials.

When he logs in successfully, is it possible to access that value from the database and somehow perform URL masking to show that subdomain in the address bar but in reality, it is the root directory of files that is being accessed?

There's really no need for subdirectories as all users access the same files, just different data being loaded from the database based on the session values/their login credentials, this is more like just for 'aesthetics' or nicer URLs.

Here is a scenario:
I'm user1. I'm asked to enter a value for my own subdomain when I sign up. I enter 'user1'. This value is saved in the database along with my username, password, etc.

Say the default domain of the website is xyz.com. On the login page, it says xyz.com, but once I'm logged in, it has to access the subdomain value I entered from the database and sort of prepend that value so the URL in the address bar will show user1.xyz.com.

But the thing is, there is really no subdirectory for user1.xyz.com since all users access the same set of files. I'm thinking of URL masking as a solution, but I'm not sure how to achieve this.

What I have tried:

I've read about redirects through .htacess but I'm not sure how will I be able to pass values to it?
Posted
Updated 16-Feb-17 14:18pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900