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 For example: 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 Could we use html5 JavaScript, get domain names from the browser to a string, use âsplit()â [ â . âas seperatorï¼ âhowmanyâ to get number of subdomains] , then apply âif elseâ or âcaseâ ï¼ Or php code? Would Apache Mod_Rewrite help??? Anyone could offer a lending hand and post all codes that I am able to use directly? *** Thanks for some answers, but the point is "unlimited keywords". 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.
-
Answer:
I am unable to understand your exact question, but if you want to get the hostname and sub-domain of a webpage using JavaScript, you can use // if url is http://in.screen.yahoo.com/anushka-goes-va-va-vroom-115000791.html var hostname = document.location.hostname; // hostname is in.screen.yahoo.com var subDomainParts = hostname.split("."); // subDomainParts is ["in", "screen", "yahoo", "com"]
Amit Tyagi at Quora Visit the source
Other answers
You don't want to do that. First things first. When someone sends a request to an URL, the packets are not sent to a specific IP address, but to a DNS (don't mind later request when the URL is cached), which in turn sends the packets to an IP address: the one you set up. As you've probably figured, the server is hit first before your JavaScript code, so it makes more sense to forward from the server configuration. I'm not at expert (nor a beginner) in the field of forwarding, but you can do this: - set wildcard records on a DNS provider - add forwarding rules in your favorite web-server config file.
Radu Cruceru
Related Q & A:
- Who is the Primary Owner of All the Domain Names?Best solution by Quora
- What are postal codes in Sweden?Best solution by en.wikipedia.org
- What are the top 5 most expensive domain names?Best solution by en.wikipedia.org
- What is the best place for me to go on a 3 night holiday in August?Best solution by Yahoo! Answers
- What impact does switching from a NCAA division 1 to division 3 has on college students and adminstrators?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.