Onno Posted November 2, 2003 Share Posted November 2, 2003 Apache is not my strongest side. But I\'m learning Any way I need for a PHP script to simulate url adresses on my Localhost. Now i acces a webpage on my locahost by 127.0.0.1 but 127.0.0.1 should become www.onno.org for example and www.tom.org etc... How do I put this in my httpd.conf script. Remember this is on my local host without any bind Using Red Hat 9.0 And apache 2.x Quote Link to comment https://forums.phpfreaks.com/topic/1268-need-to-simulate-webdomains/ Share on other sites More sharing options...
LAMP Posted November 14, 2003 Share Posted November 14, 2003 First assign the names in your hosts file. On my BSD box, it\'s /etc/hosts ... I can only assume that it\'s in a similar location in RH. Something like this should do: 127.0.0.1 www.onno.org 127.0.0.1 www.tom.org Test, and make sure that the names resolve locally. In BSD, changing /etc/resolv.conf to instruct the resolver to check the hosts file before the nameserver is simply a matter of which line comes first. Like I said, not sure about RH..... Secondly, you need to enable Name-based virtual hosting in httpd.conf. Here\'s an example: # # Use name-based virtual hosting. # NameVirtualHost *:80 # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. <VirtualHost *> ServerName www.onno.org DocumentRoot /www/onno ServerAdmin me@localhost </VirtualHost> Restart apache, voila! Quote Link to comment https://forums.phpfreaks.com/topic/1268-need-to-simulate-webdomains/#findComment-4502 Share on other sites More sharing options...
Onno Posted November 14, 2003 Author Share Posted November 14, 2003 Yes, its indeed that easy. Just vi /etc/hosts and edit it... If you don\'t know you never know unless somebody tells you Quote Link to comment https://forums.phpfreaks.com/topic/1268-need-to-simulate-webdomains/#findComment-4504 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.