Jump to content


Need to simulate webdomains

  • Please log in to reply
2 replies to this topic

#1 Onno

  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 02 November 2003 - 02:23 PM

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
but 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
learning by helping others. [br]PS. Free Software for ever!


  • Members
  • PipPip
  • Member
  • 21 posts
  • LocationMissouri, USA

Posted 14 November 2003 - 03:17 AM

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:    www.onno.org127.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!
Hope this sheds some light, [br]LAMP [br]******************************* [br]Warning: main(): Failed opening \'sig.php\' for inclusion (include_path=\'.:/usr/local/share/pear\') in /usr/local/www/data/phpfreaks/forums/topic.php on line 435

#3 Onno

  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 14 November 2003 - 08:51 AM

Yes, its indeed that easy.

Just vi /etc/hosts and edit it...

If you don\'t know you never know unless somebody tells you :D
learning by helping others. [br]PS. Free Software for ever!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users