In dem Beispiel zeigen wir Ihnen, wie Sie auf Ihrem lokalen Rechner mit Hilfe von XMAPP eine Subdomain einrichten können.
Schritt 1:
Öffnen Sie die Datei hosts unter C:\WINDOWS\system32\drivers\etc\
Tragen Sie dort folgenden Code an das Ende der Datei ein:
Beispiel A.1. Code: hosts system32\drivers\etc
127.0.0.2 blog.localhost 127.0.0.2 www.blog.localhost |
Schritt 2:
Öffnen Sie die Datei httpd.conf unter xampp\apache\conf
Tragen Sie dort folgenden Code an das Ende der Datei ein:
Beispiel A.2. Code: httpd.conf xampp\apache\conf
<VirtualHost blog.localhost> DocumentRoot c:/xampp/htdocs/blog/wordpress ServerName blog.localhost ServerAlias www.blog.localhost </VirtualHost> |
Damit haben Sie die Subdomain blog.localhost eingerichtet.
Auszug der Datei hosts für MyOOS Version ab 2.x
Beispiel A.3. MyOOS 2. hosts system32\drivers\etc
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localhost 127.0.0.2 blog.localhost 127.0.0.2 www.blog.localhost 127.0.0.3 analytics.localhost 127.0.0.3 www.analytics.localhost |
Auszug der Date httpd.conf :
Beispiel A.4. MyOOS 2.1.3: httpd.conf xampp\apache\conf
<VirtualHost blog.localhost> DocumentRoot c:/xampp/htdocs/blog/wordpress ServerName blog.localhost ServerAlias www.blog.localhost </VirtualHost> <VirtualHost analytics.localhost> DocumentRoot c:/xampp/htdocs/tracking/piwik ServerName analytics.localhost ServerAlias www.analytics.localhost </VirtualHost> |
Mehr Infos unter:
C:xampp\apache\conf\extra\httpd-vhosts.conf
Apache Dokumkentation