Hello,
We are trying to figure out if there is a way we can use subdomains as part of query string that the user submitted to our page?
What that means is, supposed the user goes to our page using something like this:
URL1: one.mydomain.com/search.php?q=hello
URL2: two.mydomain.com/search.php?q=hello
URL3: six.mydomain.com/help.php
Given the three links above, they will be processed as:
URL1: search.php?q=hello&s=one
URL2: search.php?q=hello&s=two
URL3: help.php?s=six
Is this possible to accomplish? If yes, will it be with .htaccess or PHP or something else?
Sorry if it's not clear - I can try again if that's too confusing.
thanks.
-stndn.
Edited with (hopefully) better explanation
Suppose we are creating a search script, called '/search.php', located in the root www directory of our site. The search script can be used to look for houses or condos located in either san francisco, new york, or any city in the US.
The script is supposed to be accessed as follows:
www.domain.com/search.php?item=house -> search for all houses in the US
www.domain.com/search.php?item=house&city=sf -> search for all houses in SF
www.domain.com/search.php?item=condo&city=ny -> search for all condos in NY
Now, what we are trying to accomplish is to remove the 'city' as part of the query string. Instead, we want to make the city looks like a subdomain. We don't want to create real subdomains because we don't want to end up duplicating the script '/search.php' for all the city we want to support.
So now if the user wants to search, they will enter the following:
www.domain.com/search.php?item=house -> search for all houses in the US
sf.domain.com/search.php?item=house -> search for all houses in SF
ny.domain.com/search.php?item=condo -> search for all condos in NY
We want the user to only use the second set of URL and our scripts will translate them to the first set behind the scene. We don't want the second set of URL to redirect to the first set of URL.
Sorry if it's too confusing, but that's what we are trying to accomplish. Is this any better?
Btw, eventually, we *might* even attempt something like house.sf.domain.com, but that is not a priority for now...
We are trying to figure out if there is a way we can use subdomains as part of query string that the user submitted to our page?
What that means is, supposed the user goes to our page using something like this:
URL1: one.mydomain.com/search.php?q=hello
URL2: two.mydomain.com/search.php?q=hello
URL3: six.mydomain.com/help.php
Given the three links above, they will be processed as:
URL1: search.php?q=hello&s=one
URL2: search.php?q=hello&s=two
URL3: help.php?s=six
Is this possible to accomplish? If yes, will it be with .htaccess or PHP or something else?
Sorry if it's not clear - I can try again if that's too confusing.
thanks.
-stndn.
Edited with (hopefully) better explanation
Suppose we are creating a search script, called '/search.php', located in the root www directory of our site. The search script can be used to look for houses or condos located in either san francisco, new york, or any city in the US.
The script is supposed to be accessed as follows:
www.domain.com/search.php?item=house -> search for all houses in the US
www.domain.com/search.php?item=house&city=sf -> search for all houses in SF
www.domain.com/search.php?item=condo&city=ny -> search for all condos in NY
Now, what we are trying to accomplish is to remove the 'city' as part of the query string. Instead, we want to make the city looks like a subdomain. We don't want to create real subdomains because we don't want to end up duplicating the script '/search.php' for all the city we want to support.
So now if the user wants to search, they will enter the following:
www.domain.com/search.php?item=house -> search for all houses in the US
sf.domain.com/search.php?item=house -> search for all houses in SF
ny.domain.com/search.php?item=condo -> search for all condos in NY
We want the user to only use the second set of URL and our scripts will translate them to the first set behind the scene. We don't want the second set of URL to redirect to the first set of URL.
Sorry if it's too confusing, but that's what we are trying to accomplish. Is this any better?
Btw, eventually, we *might* even attempt something like house.sf.domain.com, but that is not a priority for now...