samoht Posted September 17, 2009 Share Posted September 17, 2009 Hello all, I have a client that has several blogs (3) - currently they are all separate instances - but I am collecting them into 1 instance. My problem is that he wants to keep their unique domain names (e.g. blog1.com; blog2.com; blog3.com) So I want to setup a virtual host for each server name - but how do I transform blog1.com/blog2 into blog2.com? And importantly, will that catch all the subdomains too? (e.g. will blog1.com/blog2/about/ translate to blog2.com/about etc) Any Ideas how to set this up? Here is my httpd-vhost <VirtualHost *:80> ServerAdmin aadcock@test.com DocumentRoot C:/cygwin/home/test/blog1 ServerName blog1.local <Directory "C:/cygwin/home/test/blog1"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost */blog2:80> ServerAdmin aadcock@test.com DocumentRoot C:/cygwin/home/test/blog1 ServerName blog2.local <Directory "C:/cygwin/home/test/blog1"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> do I need to do some .htaccess stuff too to get this to work?? Quote Link to comment https://forums.phpfreaks.com/topic/174605-rewrite-query-to-have-its-own-main-domainvirtual-host/ Share on other sites More sharing options...
steviewdr Posted September 18, 2009 Share Posted September 18, 2009 Well you could easily do this: Under: "ServerName blog2.local", put "ServerAlias blog3.local" and another line "ServerAlias blog4.local". Overall it'd look like: <VirtualHost */blog2:80> ServerAdmin aad@test.com DocumentRoot C:/cygwin/home/test/blogcommon ServerName blog1.local ServerAlias blog2.local ServerAlias blog3.local ServerAlias blog4.local Note, the addresses will remain the same in the address bar, it just means that you can run the 4 domains from 1 document root. -steve Quote Link to comment https://forums.phpfreaks.com/topic/174605-rewrite-query-to-have-its-own-main-domainvirtual-host/#findComment-920781 Share on other sites More sharing options...
samoht Posted September 18, 2009 Author Share Posted September 18, 2009 Thanks steviexdr, That gets me the ability to have the different domain names from the same document root. good start. However, I need blog2.local to be the domain name when the user is viewing blogs in that category/page - which normally is distinguished by the query string (e.g. blog1.local/?p=2) or sometimes by the path blog1.local/blog2/ Any ideas on that ? Quote Link to comment https://forums.phpfreaks.com/topic/174605-rewrite-query-to-have-its-own-main-domainvirtual-host/#findComment-920857 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.