HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - Linux
 - >
 - Domain name based location in server
 
Operating System - Linux
        1840150
        Members
    
    
        3479
        Online
    
    
        110161
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
 - Entry Storage Systems
 - Legacy
 - Midrange and Enterprise Storage
 - Storage Networking
 - HPE Nimble Storage
 
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
 - Appliance Servers
 - Alpha Servers
 - BackOffice Products
 - Internet Products
 - HPE 9000 and HPE e3000 Servers
 - Networking
 - Netservers
 - Secure OS Software for Linux
 - Server Management (Insight Manager 7)
 - Windows Server 2003
 - Operating System - Tru64 Unix
 - ProLiant Deployment and Provisioning
 - Linux-Based Community / Regional
 - Microsoft System Center Integration
 
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
 - Mark Topic as New
 - Mark Topic as Read
 - Float this Topic for Current User
 - Bookmark
 - Subscribe
 - Printer Friendly Page
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2003 08:59 AM
04-26-2003 08:59 AM
			
				
					
					
						I have two domain names pointing to the same IP address. I'm running Apache server that comes with RedHat 7.1. Does someone know if there is a way to direct one domain name to one web page on Apache and direct the other domain name to another web page.
					
				
			
			
				
			
			
				
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
Solved! Go to Solution.
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2003 09:51 AM
04-26-2003 09:51 AM
Solution
			
				
					
					
						Hi,
you could use mod_vhosts_alias and add this to your /etc/httpd/conf/Vhosts.conf file
# Dynamic mass virtual hosting
UseCanonicalName Off
VirtualDocumentRoot /var/www/html/vhosts/%2+/%1/
LogFormat "%v %h %l %u %t \"%r\" %s %T %b" VLOG
IndexOptions FancyIndexing IconHeight IconWidth IconsAreLinks FoldersFirst
CustomLog logs/access_log VLOG
This will take the domain name in the header and redirect it to the proper folder.
Exemple:
http://www.domain.com would be redirected to /var/www/html/vhosts/domain.com/www/
--
http://www.domain2.org would be redirected to /var/www/html/vhosts/domain2.org/www/
Thanks,
JP
					
				
			
			
				
		
		
	
	
	
you could use mod_vhosts_alias and add this to your /etc/httpd/conf/Vhosts.conf file
# Dynamic mass virtual hosting
UseCanonicalName Off
VirtualDocumentRoot /var/www/html/vhosts/%2+/%1/
LogFormat "%v %h %l %u %t \"%r\" %s %T %b" VLOG
IndexOptions FancyIndexing IconHeight IconWidth IconsAreLinks FoldersFirst
CustomLog logs/access_log VLOG
This will take the domain name in the header and redirect it to the proper folder.
Exemple:
http://www.domain.com would be redirected to /var/www/html/vhosts/domain.com/www/
--
http://www.domain2.org would be redirected to /var/www/html/vhosts/domain2.org/www/
Thanks,
JP
	Open your Mind and use Open Source software...
			
			
				
			
			
			
			
			
			
		- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2003 12:30 PM
04-26-2003 12:30 PM
			
				
					
						
							Re: Domain name based location in server
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Thanks, I'll try that. I'll have to study that awhile to understand how it can work.
I take it that the should be the IP address of my server. I don't understand exactly the path. Do I need to create directories under the specific name "vhosts" or is will any path to a folder work?? 
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
I take it that the
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-27-2003 04:30 AM
04-27-2003 04:30 AM
			
				
					
						
							Re: Domain name based location in server
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Hi,
Every host using the dynamic mass virtual hosting have a dns "A" record pointing to 192.168.10. My webserver ip is 192.168.1.5 and i've created a virutal interface eth0:0 with the ip 192.168.1.10
The path to the VirtualDocumentRoot could be anything. VirtualDocumentRoot /var/www/html/vhosts/%2+/%1/ . By default Mandrake create the apache root directory in /var/www/html so i created a folder "vhosts" to put all my virutal host. You could change it to what you want. ( /home/httpd/vhosts/... ) and create a folder with the domainname.com and in this directory create the www folder.
The important part is %2+ and %1. This is making the whole thing dynamic.
Host examples and where they would be redirected:
www.domain.com /path/to/vhosts/domain.com/www/index.html
support.domain.org /path/to/vhosts/domain.org/support/index.html
secure.domain.net /path/to/vhosts/domain.net/secure/index.html
Here is some good documentation about virtual hosting:
http://httpd.apache.org/docs/vhosts/mass.html
http://httpd.apache.org/docs/mod/mod_vhost_alias.html
Thanks,
JP
		
		
	
	
	
Every host using the dynamic mass virtual hosting have a dns "A" record pointing to 192.168.10. My webserver ip is 192.168.1.5 and i've created a virutal interface eth0:0 with the ip 192.168.1.10
The path to the VirtualDocumentRoot could be anything. VirtualDocumentRoot /var/www/html/vhosts/%2+/%1/ . By default Mandrake create the apache root directory in /var/www/html so i created a folder "vhosts" to put all my virutal host. You could change it to what you want. ( /home/httpd/vhosts/... ) and create a folder with the domainname.com and in this directory create the www folder.
The important part is %2+ and %1. This is making the whole thing dynamic.
Host examples and where they would be redirected:
www.domain.com /path/to/vhosts/domain.com/www/index.html
support.domain.org /path/to/vhosts/domain.org/support/index.html
secure.domain.net /path/to/vhosts/domain.net/secure/index.html
Here is some good documentation about virtual hosting:
http://httpd.apache.org/docs/vhosts/mass.html
http://httpd.apache.org/docs/mod/mod_vhost_alias.html
Thanks,
JP
	Open your Mind and use Open Source software...
			
			
				
			
			
			
			
			
			
		The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP