Jump to content

rewrite query to have its own main domain/Virtual host??


samoht

Recommended Posts

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 [email protected]
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 [email protected]
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??

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 [email protected]

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

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 ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.