What are usable codes to do URL forwarding according to Level 3 domain names?
I need to pre-define almost unlimited number of keywords for Level 3 and Level 2 subdomains, in order to forward those pre-defined user-friendly, recognizable domain names to my primary site.
I need to preset: type-in keyword subdomains = parts of the forwarded URLs
subdomain name “toy” = “noun-1” part of the forwarded URLs
subdomain name ”food”= “noun-2” part of the forwarded URLs
number of pre defined noun should be unlimited
any undefined noun = “noun-0”
subdomain name “my” = “whose-1” part of the forwarded URLs
subdomain name “your” = “whose-2”part of the forwarded URLs
subdomain name “his” = “whose-3”part of the forwarded URLs
number of pre defined possessive pronoun should be unlimited
any undefined possessive pronoun = “whose-0”
So that domain names such as“http://toy.website.com” and “http://food.website.com” could be forwarded to some predefined URLs.
“http://toy.website.com” could be forwarded to http://www.myplace.com/noun-1-whose-0 (“noun-1”first， then ”whose-0”)
http://food.website.com could be forwarded to http://www.myplace.com/noun-2-whose-0
If we type in“http://my.toy.website.com” , it could be forwarded to http://www.myplace.com/noun-1-whose-1
and http://your.food.website.com needs to redirect to http://www.myplace.com/noun-2-whose-2
“http://my.website.com” to http://www.myplace.com/noun-0-whose-1
http://your.website.com to http://www.myplace.com/noun-0-whose-2 (“noun-0”should be in place)
If we type in some undefined words, for example, http://undefined_whose.toy.website.com should be forwarded to http://toy.website.com [just drop undefined words]， then forward again to http://www.myplace.com/noun-1-whose-0 accordingly.
http://my.undefined_noun.website.com first to http://my.website.com then to http://www.myplace.com/noun-0-whose-1
If we only type-in level 2 subdomains without level 3 subdomains, such as http://undefined_words.website.com , or type in more than level 4 subdomains, or “both undefined level 3 and undefined level 2” ,such as http://undefined_whose.undefined_noun.website.comthey should be redirected uniformly to http://www.myplace.com/domain_rule.html
Would Apache Mod_Rewrite help???
Anyone could offer a lending hand and post all codes that I am able to use directly?
*** If I set records on a DNS provider, it's fine if the keywords are limited in numbers. But when we consider scaling-up keywords, manually set "Johns.toy", "Marys.toy", "Janes.toy"...and "Janes.food", "Janes.bag", "Janes.book"...."Leos.light"...would be unrealistic.
It is not recommended to do this in mod_rewrite. Processing lots of rewrite rules on each request will have significant impact on server performance. You should pass the whole request to a script and process it with a script, this would be not only more resource effective but also much easier because you can use regular expressions, loops, conditions and even the database.
Mod rewrite or doing it via a script will both have an overhead.
... and please remember to wrap code with forum BBCode tags:-
[CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]
If you can't think outside the box, you will be trapped forever with no escape...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread