VirtualHost Same ServerName Different Directories (mirror codes)

136 views Asked by At

There is currently a problem as follows - [I have read this similar Question, but I don't use proxy]

The official code uses the SVN version control under the root directory of the apache document root, which connects the official database.

I need to build a mirror (in other directory) which completely copy the SVN code, but connect the test database for testing.

But two directories site use same VirtualHost Servername set as follows

<VirtualHost *: 80>
   DocumentRoot "E: / website-PHP / online"
   ServerName website
</VirtualHost>

The current situation is:
When connecting http://website and browsing sub-pages are normal, such as http://website/test but when I connect to http://website/mirror and browse the sub-pages, because of the path in the code was written Absolutly. http://website/mirror/test this page is replaced automatically by http://website/test and connection failed.

※ I have tried using the rewrite engine

RewriteCond% {SERVER_NAME} localhost [OR]
RewriteCond% {SERVER_NAME} website
RewriteCond% {REQUEST_URI}! Mirror
RewriteRule ^ (. *) $ Https: //% {SERVER_NAME} / mirror% {REQUEST_URI} [R = 301, L]

But the situation will become :
http://website redirect to the test area http://website/mirror/

※ try to use two sets of virtualhost:

<VirtualHost *: 80>
  DocumentRoot "E: / website-PHP / online"
  ServerName website
</VirtualHost>
<VirtualHost *: 8080>
  DocumentRoot "E: / website-PHP / online / mirror"
  ServerName website
</VirtualHost>

apache can start up,but can't connect to http://website:8080/
and didn't have any error log

Any Solution without editing source code? Thanks!

※ My apache edition is 2.2.25

0

There are 0 answers