Jump to content

Redirecting depending on refferal.


imrie

Recommended Posts

Ok, one of the guys on this forum gave me the following code:

var ref = document.referrer;if(ref.indexOf("google.") > -1) //this will catch google.com, google.ca, etc, etc{  window.location = "index.shtml"; //or whatever your index page is}

It redirected anyone arriving at the page to index.shtmlNow i was wondering, If i wanted another domain for my subdomain, could i edit this code and to this:var ref = document.referrer;if(ref.indexOf("newdomain.com") { window.location = "subdomain.ofmy.site"; //or whatever your index page is}And if i bought a domain and parked it on my hosters server. Im i right by thinking any one from "newdomain.com" would got to "subdomain.ofmy.site" and the rest stay.Thanks.

Link to comment
Share on other sites

The referrer is the page that you clicked on to bring you to the current page. If you are looking at page1.html and you click a link to go to page2.html, the referrer for page2.html is set to page1.html. The referrer tells you where the visitor came from. If you are checking in the referrer for "newdomain.com", then you are checking if the person came from there to reach the current page.

Link to comment
Share on other sites

What are you trying to do, forward all requests for one domain to another domain? If that's what you want to do, then you should be able to set that up on the webserver if you have a control panel for your server. If you don't have access to a control panel, you'll probably have to send an email to tech support for your server telling them you want to do domain forwarding.

Link to comment
Share on other sites

No its not that, but its similar. Im i right in thinking that domain forwarding will only send you to the root of the address? I am wanting to send the vistor to example: support.mydomain.comThis is what i want:mysitesupport.com to forward to support.mydomain.comis this possible? if so how?Thanks

Link to comment
Share on other sites

You can set it up several ways. You could point several domains to the same webserver. We have one webserver here that has maybe 20 websites on it all with the same IP address, in that case the server checks the host header to determine which site they are trying to get to. I also have a server where two domains are parked on it, so the files on that server I can reference with either name. If I put a file on the server I can access it at both domain1.com/file or domain2.com/file, both addresses point to the same server. It works with email as well, my account gets the mail regardless of which domain it is sent to, it's the same server.You can do several things with domain forwarding or parking or redirecting, but they are all done on the server. You need to configure the server and possibly DNS to set everything up.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...