开发者

How to redirect using url

开发者 https://www.devze.com 2023-04-13 01:06 出处:网络
I have obtained hosting space and they registered domain(say www.abc.com) with an ip(say http://1.2.3.4/~myspace) for me to. But i want to use it as two websites. i.e. if i type www.abc.com then it sh

I have obtained hosting space and they registered domain(say www.abc.com) with an ip(say http://1.2.3.4/~myspace) for me to. But i want to use it as two websites. i.e. if i type www.abc.com then it show open the index.html file inside a folder called "friend" in my public_html dir. And when i type http://1.2.3.4/~myspace it shud as normally open the index.html in root.!

Is it possible to

  1. redirect to the inner folder when user types domain name
  2. not redirect inner folder (but rather open the root's index) when user enters "ip address". Help me out here

@dan360: yeah i did the scripti开发者_Python百科ng.. got it dude!! very much thanks.!

just incase anyone comes across this.. here's the code I used

 <script type="text/javascript">
/* <![CDATA[ */
if (top.location == "http://www.abc.com/")
top.location = "http://www.abc.com/friend/index.htm";
/* ]]> */
</script>

Now i can use my ip to access my site alone


You can but you need to do some scripting.

You can read the url and domain with asp, php, javascript and many other scripting languages. All you need to do is read it and make a decision to redirect if you are on www.abc.com.

However you should note that when the redirect happens without some kind of url masking, the url would read www.abc.com/friend/


Assuming you have a web host and not a vps or ps this can vary a lot depending on how your account is set up (some cases they moght not even let you). you'll have to ask technical support for your web host.

0

精彩评论

暂无评论...
验证码 换一张
取 消