fansphp Posted May 11, 2009 Share Posted May 11, 2009 Hi All, I require your help. I have a domain name and there are around 100 links inside the domain name, for example, www.domain.com is the domain name and links are like this www.domain.com/1/123/ and www.domain.com/3/456 I am creating 100 subdomain on my domain name and what i require is that, there will be only 1 common index page of all the subdomain, when somebody goes to 1.domain.com it will take him to that index page, in that index page, it see the subdomain and and opens the include of the coressponding links. For this heres an example, if somebody goes to 1.domain.com it opens the index page, in index page theres a code, in the code it sees that for 1.domain.com it should put the php include link as www.domain.com/1/123 I am not sure about the code, <?php echo $_SERVER['SERVER_NAME']; ?> where i think server_name is subdomain.domain.com it than runs a query SELECT links FROM content WHERE subdomain = '$_SERVER[sERVER_NAME]' Please help me with this code. Or is there any other way to do it, so that in only 1 page, it understands the subdomain name and open the corresponding site, But there should be different Title for each of this pages. Thanx Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 WOW! That is just ridiculous. 100 subdomains just to redirect someone? But I am lost on your question. What's your question? Quote Link to comment Share on other sites More sharing options...
revraz Posted May 11, 2009 Share Posted May 11, 2009 This should be doable with mod rewrite. Quote Link to comment Share on other sites More sharing options...
fansphp Posted May 11, 2009 Author Share Posted May 11, 2009 Here is the question in simple language, My Domain Name has many links which is very lengthy, i am creating subdomains for each links, all the subdomains will open a page where the links just opens up inside(using the php include command), i am not redirecting it, as these subdomains will have their individual titles too, what i want is instead of creating seperate individual index pages for each subdomains, i will creating a common index page, when somebody opens any of these subdomains, it opens that index page and inside that index page a query runs where it see the subdomain name and open the respective page with the corresponding Title. [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 What's your question? Quote Link to comment Share on other sites More sharing options...
fansphp Posted May 11, 2009 Author Share Posted May 11, 2009 Did you understand the matter, than please help me with the code which i can put on that index page, or if i have to create a sql table and run a query on that index page. Please tell me what you understood, so that i can explain you. Really sorry for my bad english Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 1. I can't help you because you haven't asked a question. You want an answer without a question? 2. What code? That one line is the code you need help with? Quote Link to comment Share on other sites More sharing options...
jackpf Posted May 11, 2009 Share Posted May 11, 2009 Just found this - http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/ Should do you nicely. Quote Link to comment Share on other sites More sharing options...
Stryves Posted May 11, 2009 Share Posted May 11, 2009 I think the question is 1. Someone goes to one.domain.com 2. How do you grab the "one" and do a query to grab the links for anyone that goes to "one".domain.com, because someone going to "two".domain.com would receive a different set of links. mod rewrite would probably be easiest, because then you could have it specified via path and string... I'm guess if that's what you are looking for. Quote Link to comment Share on other sites More sharing options...
revraz Posted May 11, 2009 Share Posted May 11, 2009 I gave you the answer earlier... Did you understand the matter, than please help me with the code which i can put on that index page, or if i have to create a sql table and run a query on that index page. Please tell me what you understood, so that i can explain you. Really sorry for my bad english Quote Link to comment Share on other sites More sharing options...
fansphp Posted May 11, 2009 Author Share Posted May 11, 2009 I think the question is 1. Someone goes to one.domain.com 2. How do you grab the "one" and do a query to grab the links for anyone that goes to "one".domain.com, because someone going to "two".domain.com would receive a different set of links. mod rewrite would probably be easiest, because then you could have it specified via path and string... I'm guess if that's what you are looking for. You have actually understood to what i am looking for. Can you help me with this, the code.. Thanx alot Quote Link to comment Share on other sites More sharing options...
fansphp Posted May 11, 2009 Author Share Posted May 11, 2009 Please reply. Please help me regarding the script, what script should i put in. Thanx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.