1

I need redirect the domain (www.pokus.cz) to my local IP address (192.168.1.100/preview) because I need to make a test of my new web pages. I read that it's possible with add lines in /etc/hosts/ When I add this:

192.168.1.100 www.pokus.cz

it works but it's not what I need.

I need something like this

192.168.1.100/preview www.pokus.cz

unfortunately this doesn't work... Can you help me please?

2
  • 2
    to my knowledge, the hosts file does 1 thing. routes names to IP addresses. any additional routing after that would need to take place in your http server.
    – castis
    Jun 26, 2015 at 16:38
  • You need to use a web server, gateway, or proxy to edit the URL to add '/preview' to it.
    – ztk
    Jun 26, 2015 at 17:18

1 Answer 1

3

You need to do this in the webserver configuration. In apache it's set in the vhost configuration. It depends on your server setup how this is configured. The hosts file you're referring to is meant to link a domain name to an IP-address. That domain name may not exist outside your network, or may have a different IP-address outside your network.

1
  • 1
    Thank you very much, I set up my virtual host and local hosts file and it works! Jun 27, 2015 at 10:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .