User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,504 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,683 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1630 | Replies: 9 | Solved
Reply
Join Date: Aug 2007
Posts: 5
Reputation: RGStrat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
RGStrat RGStrat is offline Offline
Newbie Poster

Question 2 Websites...1 IP

  #1  
Sep 27th, 2007
Hello, I have 2 different websites/domains on 1 IP. The problem is that whenever stuff is uploaded, it displays in both sites.

Example: site_1.com/page.php = site_2.com/page.php

I created a directory for each site.

Example: site_1.com/site_1 and site_2.com/site_2 .

I want to create a script that resides as the index of the IP and directs the viewer to the proper directory by what URL they typed in.

For example: If they typed in site_1.com it would take them to site_1.com/site_1 and if they typed in site_2.com it would take them to site_2.com/site_2.

Can someone show me how to do this please? It's slightly urgent....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: 2 Websites...1 IP

  #2  
Sep 27th, 2007
stuff concerning domains and what folder they are directed to has to deal with server configuration. there is no need to make a script to do this for you.
Reply With Quote  
Join Date: Aug 2007
Posts: 5
Reputation: RGStrat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
RGStrat RGStrat is offline Offline
Newbie Poster

Re: 2 Websites...1 IP

  #3  
Sep 28th, 2007
Yes, but I can't configure the server as it's not mine. I have seen this done with Javascript but the downside was it didn't work in FF.
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: 2 Websites...1 IP

  #4  
Sep 28th, 2007
try this:

<script type="text/javascript">
var href = window.location.href;
if (href == 'http://yoursite.com/') {
window.location='site_1/index.html';
}
else {
window.location='site_2/index.html';
}
</script>

i just typed it. i think it will work
Reply With Quote  
Join Date: Aug 2007
Posts: 5
Reputation: RGStrat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
RGStrat RGStrat is offline Offline
Newbie Poster

Solution Re: 2 Websites...1 IP

  #5  
Sep 28th, 2007
Originally Posted by kkeith29 View Post
try this:

<script type="text/javascript">
var href = window.location.href;
if (href == 'http://yoursite.com/') {
window.location='site_1/index.html';
}
else {
window.location='site_2/index.html';
}
</script>

i just typed it. i think it will work

Thanks. It didn't work in FF though so I tried this:

<script type="text/javascript">
var href = window.location.href;
if (href == 'http://snowmanlady.com/') {
window.location='Main/index.htm';
}
if (href == 'http://movingtargetdesigns.com/') {
window.location='DesignMain/index.htm';
}
</script>
This works in IE but not in FF. Suggestions?

P.S. I tried to up your rating and accidentally hit 'disprove' . Sorry. D*mmit.
Last edited by RGStrat : Sep 28th, 2007 at 11:25 pm.
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: 2 Websites...1 IP

  #6  
Sep 28th, 2007
i tried it on six different browsers and they all worked. firefox worked just fine when i typed in your url. what exactly is the problem? it maybe the version, thats the only thing i can think of.
Last edited by kkeith29 : Sep 28th, 2007 at 11:40 pm.
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: 2 Websites...1 IP

  #7  
Sep 28th, 2007
i found a problem. if the user uses www in front of the url it doesn't work. you need to add these to the javascript code.

<script type="text/javascript">
var href = window.location.href;
if (href == 'http://snowmanlady.com/' || href == 'http://www.snowmanlady.com/') {
window.location='Main/index.htm';
}
if (href == 'http://movingtargetdesigns.com/' || href == 'http://www.movingtargetdesigns.com/') {
window.location='DesignMain/index.htm';
}
</script>
Last edited by kkeith29 : Sep 28th, 2007 at 11:46 pm.
Reply With Quote  
Join Date: Aug 2007
Posts: 5
Reputation: RGStrat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
RGStrat RGStrat is offline Offline
Newbie Poster

Help Re: 2 Websites...1 IP

  #8  
Sep 29th, 2007
Thank you so much! I don't know what I would have done! I specialize in CSS and XHTML, not Javascript (I'm just starting to learn it ). By the way, I like this script so much I want to share it. If you PM me your name and stuff I would like to submit it to JS source sites. This is the only cross-browser version I have seen, and I'm sure others have had this problem to. Again, Thanks a million!
Reply With Quote  
Join Date: Jan 2007
Posts: 2,604
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 119
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: 2 Websites...1 IP

  #9  
Sep 29th, 2007
Why are you fussing with scripts? Just include the folder name in the published url:

www.thisismydomain1.com/site1foldername/site1page.htm

www.thisismydomain2.com/site2foldername/site2page.htm
Last edited by MidiMagic : Sep 29th, 2007 at 3:47 pm.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Aug 2007
Posts: 5
Reputation: RGStrat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
RGStrat RGStrat is offline Offline
Newbie Poster

Re: 2 Websites...1 IP

  #10  
Sep 29th, 2007
Because this makes a cleaner, more professional look.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC