Testing server (base href / virtual hosts)
Hi
I have a testing server here serving for about twenty sites. Now the setup I have is an Apache box with it's DocumentRoot set to /store/htdocs and then I put in a new folder in htdocs for each site, so I access each site through a web browser at:
http://testing-server/site1
http://testing-server/site2
etc.
Now, the problem is, when I upload the sites they all have their own domain names, so effectively their document root is / but on my local testing server their document root is /site1 and /site2 etc.
See my problem?
What is the best workaround for this? I really don't want to use BASE_HREF tags as it's an ugly way of doing things. I've looked into Apache conigs and virtual hosting and thinking that I should maybe setup my testing server to be :
http://site1.testing-server/
http://site2.testing-server/
etc.
I think that would make more sense. However, is there a way to force /site1 to be document root for everything in /site1 and thereafter? There must be a way to set this, maybe as a .htaccess option if possible too?
Any ideas?
Thanks.
- wil
zollet posted this at 12:57 — 2nd July 2003.
He has: 1,016 posts
Joined: May 2002
What do you want to happen if/when someone goes (in)directly to http://www.testing-server/ ?
From what I've seen and know, you cannot set a subdirectory on a domain as a root directory since the user can always go to the domain alone. So the best way would be to do subdomains if they sites don't have their own domain names.
druagord posted this at 13:46 — 2nd July 2003.
He has: 335 posts
Joined: May 2003
it depends on what you want to test. On my server the testing_server is just an index page containing 2 frames one that links to all my sites real domain with a target to the second frame wich is 750 by 450 like this i can check for resolution too since most of my users are in a 800x600 resolution.
IF , ELSE , WHILE isn't that what life is all about
Mark Hensler posted this at 17:38 — 2nd July 2003.
He has: 4,048 posts
Joined: Aug 2000
DocumentRoot can only be set within the server config or a VirtualHost config. So that eliminates all .htaccess, Directory, and Location options. You don't want to change the main server's DocumentRoot, so that leaves VirtualHost.
DocumentRoot /store/htdocs
<VirtualHost site1.testing_server>
DocumentRoot /store/htdocs/site1
ServerName site1.testing_server
</VirtualHost>
<VirtualHost site2.testing_server>
DocumentRoot /store/htdocs/site2
ServerName site2.testing_server
</VirtualHost>
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.