简体   繁体   中英

Proper url in address bar

I have got a site running on apache. Now I have a domain. Lets say: [www.mysite.com][1] . When I enter this it goes to for example to [www.sites/sitedirectory][2] this I see in the address bar.

How can I make sure (i think it shoult be done with .htaccess) that it will still show in my address bar [www.mysite.com][3] and not [www.sites/sitedirectory][4]

Thanks very much.

You cannot make a browser's address bar show a domain different from where the data was loaded from, for security reasons.

There are a few options:

  1. You can set up www.mysite.com to be a proxy, which fetches content from www.sites/sitedirectory, and re-serves it, but I suspect that isn't really what you want.
  2. You can put a web page at wwww.mysite.com which consists of one large HTML frame containing the real site at www.sites/sitedirectory. This is widely considered to be a bad idea, as (without a lot of messing about) it means that you can only ever link to the home page, and links to other sites have to be specially written to jump out of the frameset, etc, etc.
  3. You can sort out your Apache configuration so that there is a proper vhost entry for www.mysite.com, rather than a redirect to the other URL.

Without knowing why you have got to where you are, I would strongly suggest investigating option 3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM