-2
<script>
document.write(location.href);
</script>

gives me the domain with the directory which is for example (something.com/g) what i want is that content hosted on something.com/g seems like is hosted in something.com so that it tells all eveything im hosted in something.com.if you could give the response in javascript it would help.thank you

rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
  • 3
    For hopefully very obvious reasons, you can't (unless you change the DNS on the user's machine which needs their involvement and is not trivial) – Dave Oct 14 '13 at 19:49
  • 2
    Talk about shady practice. – epascarello Oct 14 '13 at 19:53
  • So, a possible effort to salvage the question: "www.something.com" is the domain. If the browser's URL is "www.something.com/subfolder/place.php", the domain is still "www.something.com", and the query directory (probably has many names) is "/subfolder/place.php". If you are simply trying to have a browser at "something.com/viewContacts", while taking information from "something.com/phplib/datastructs/contacts.php" (a PHP file in that directory), that's much more doable - but the question sounds very different from that as it is. – Katana314 Oct 14 '13 at 20:07
  • gives me the domain with the directory which a (something.com/g) what i want is that content hosted on something.com/g seems like is hosted in something.com – user2880108 Oct 14 '13 at 20:37

2 Answers2

1

It's not ever wise to try to fake a browser into thinking they are at a different domain. I personally don't know how to do it nor will I ever try. This is explicitly unethical.

However, on a more constructive note, you might find part of your answer here: Is there a way to change the browser's address bar without refreshing the page?

Community
  • 1
  • 1
Joao
  • 2,696
  • 2
  • 25
  • 35
0
  1. Point (using DNS) the domain you want the content to appear on at a web server
  2. Host the files you want to be available on that domain on that server
  3. Configure the server the original domain is pointing to to issue a 301 or 302 redirect response when the directory is accessed
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335