View previous topic :: View next topic |
Author |
Message |
cldickerson -
Joined: 08 May 2004 Posts: 23
|
Posted: Thu Sep 23, 2004 4:55 pm Post subject: Running multiple sites (using Javascript) |
|
|
It is possible to run multiple sites in Abyss using a short Javascript code in the header of your index.html page. Using Java over PHP does have its advantages. In PHP, your script must be configured to detect domain.com as well as www.domain.com or it won't work. If a user enters www.domain.com/page1.html, they won't be redirected unless the PHP script is configured with that address. With the Javascript below, the URL (however entered into the user's browser) will redirect to the proper directory.
PHP also requires that your main (index.html) page be renamed to index1.html, or home.html, or whatever. With Java, if the need for a redirect is not detected, the index.html page will be displayed as normal.
Insert the following Javascript into the header (between <HEAD> and </HEAD>) of your main (index.htm) page. Just below the <TITLE> line is a good place...
<SCRIPT LANGUAGE="JavaScript">
var refarray = new Array();
refarray['DomainOne.com'] = "DirectoryOne";
refarray['DomainTwo.com'] = "DirectoryTwo";
refarray['DomainThree.com'] = "DirectoryThree";
refarray['DomainFour.com'] = "DirectoryFour";
for (var i in refarray) {
if (document.URL.indexOf(i) != -1) window.location.replace(refarray[i]);
}
</script>
Now, simply change the variables to reflect the URL (such as aprelium.com) to be redirected, and the directory containing the website for that URL. Do not enter the URL prefixed by 'WWW.' - simply enter the domain name. Do not use a slant or backslash before or after the directory name - simply enter the name of the directory.
Give it a try!
Claude |
|
Back to top |
|
|
HIWD -
Joined: 13 Apr 2004 Posts: 142 Location: Dublin, Ireland
|
Posted: Fri Oct 01, 2004 9:42 pm Post subject: |
|
|
Thanks for the script man, its really simple and it works prefect. Did you make this yourself? |
|
Back to top |
|
|
Axis -
Joined: 29 Sep 2003 Posts: 336
|
Posted: Sat Oct 02, 2004 12:03 am Post subject: |
|
|
Hi Claude--
Will search engines be able to follow the javascript? Many search engines have trouble with javascript.
Regards,
Axis |
|
Back to top |
|
|
cldickerson -
Joined: 08 May 2004 Posts: 23
|
Posted: Tue Oct 05, 2004 12:15 pm Post subject: JavaScript |
|
|
Thanks. Yep, it's a pretty simple script. I prefer it to the PHP coding. And, no - search engines will probably not be able to follow the script, but then they would have the same problem following the PHP script.
Claude |
|
Back to top |
|
|
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Wed Oct 06, 2004 2:37 am Post subject: |
|
|
search engines do not follow javascript. A band-aid for the problem is to use <noscript> tags for search engines to follow.
example:
<noscript>
<a href =http://www.mysite.com/main.html>mysite.com</a>
<a href =http://www.hissite.com/default.html>hissite.com</a>
<a href =http://www.hersite.com/enter.html>hersite.com</a>
</noscript>
and add a meta tag for robot directions
<meta name="robots" content="index,follow">
search engines will be able to follow if you do this.
search engine robots will be able to follow any server side script unconditionally. |
|
Back to top |
|
|
WolfRamiO -
Joined: 30 May 2004 Posts: 121 Location: Viña del Mar, Chile
|
Posted: Thu Dec 23, 2004 5:26 pm Post subject: |
|
|
i find a detail, if your browser doesn´t have java script enable, the server just show the srcipt lines >B^p... because client browser do as compiler. |
|
Back to top |
|
|
cldickerson -
Joined: 08 May 2004 Posts: 23
|
Posted: Fri Dec 24, 2004 3:16 am Post subject: |
|
|
You mean that there is actually someone left on this planet who is running a browser that doesn't support Java? |
|
Back to top |
|
|
WolfRamiO -
Joined: 30 May 2004 Posts: 121 Location: Viña del Mar, Chile
|
Posted: Fri Dec 24, 2004 3:25 am Post subject: |
|
|
yeah! |
|
Back to top |
|
|
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Fri Dec 24, 2004 5:04 pm Post subject: |
|
|
cldickerson wrote: | You mean that there is actually someone left on this planet who is running a browser that doesn't support Java? |
no most do, but some users chose to disable Java/JavaScript for security reasons. For example in my browser, I've set it to run JavaScripts, but not Java. _________________ Olly |
|
Back to top |
|
|
UtahLugers -
Joined: 13 Jan 2005 Posts: 7 Location: USA
|
Posted: Fri Jan 28, 2005 1:59 am Post subject: |
|
|
I know I may be bringing this back from the dead and I should brush up on my javascripting but if someone knows a lot about this and can do it fast, that would be way cool.
I know the problem with this script (and the PHP script?) is that it will redirect to another directory making it harder to host multiple sites. Now, i'll have to look at the coding again but i'm sure that we could add in some code where the output is (where it says to redirect the page) and instead put in some if/then coding saying: IF it is xxbb.com then proceded to __(line xx or whatever)___ (coding w/ document.write (" frames etc") ). If it is NOT xxbb.com, continue... IF it is NOT xxcc.com continue, IF it is xxdd.com, go to the correct coding.
The only problem with this is (that I can see); if someone types xxbb.com and then views the source, they will see all this coding of the redirect? _________________ This is me....I don't want to be like you. |
|
Back to top |
|
|
|