Jump to content

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


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 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??

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

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 ?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.