dev09
asked on
Mirror directory
Hi all,
I'm wondering if mirroring a directory is possible. E.g. abc.com/test-123/ = abc.com/test/
So it would not redirect, but would look at the same files on the other directory. The reason is for a custom web app - to have a 2nd version for testing. Each directory would look at different databases but both share the same files (php, css, images, etc)
I can do a detect URI in php to choose which database to look at. It's having the ability to mirror the same web files is the question.
I've had a play with htaccess files
But get a misconfiguration when trying to view in a web browser.
I know parking a 2nd domain can effectively look at another domains root folder - but we're not wanting this as we're dealing with directories on the same domain.
I hope someone has a solution or can point me in the right direction.
Thanks
I'm wondering if mirroring a directory is possible. E.g. abc.com/test-123/ = abc.com/test/
So it would not redirect, but would look at the same files on the other directory. The reason is for a custom web app - to have a 2nd version for testing. Each directory would look at different databases but both share the same files (php, css, images, etc)
I can do a detect URI in php to choose which database to look at. It's having the ability to mirror the same web files is the question.
I've had a play with htaccess files
Alias /test-123/ /test/
But get a misconfiguration when trying to view in a web browser.
I know parking a 2nd domain can effectively look at another domains root folder - but we're not wanting this as we're dealing with directories on the same domain.
I hope someone has a solution or can point me in the right direction.
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Your question focuses on the tip of the iceberg. It's an important question and it's wise to ask, however there is more to the issue than the part that meets the eye.
You may want to become familiar with the concepts of source code repository management and test-driven development. I believe that the folks at php[Architect] have a current publication that explores these topics. It's too much to write about in a Q-n-A forum, but it's where you want to spend some time in order to organize your workflow and navigate your way forward.
This link offers a simple and concise explanation. It encompasses a great depth of experience.
http://nvie.com/posts/a-successful-git-branching-model/
Twitter has used a design like this:
twitter.com <-- live site ("production")
www.twitter.com <-- redirects to live site
beta.twitter.com <-- pre-production code branch
dev.twitter.com <-- pre-release code branch
test.twitter.com <-- unit test, developer sandbox, unstable
docs.twitter.com <-- RTFM
help.twitter.com <-- forum, wiki, conversation, etc
Once you begin using Git correctly you will be amazed how easy it is to handle everything related to source code management and testing workflow. In my opinion, this is the greatest advancement in software development since the introduction of object-oriented programming!
You may want to become familiar with the concepts of source code repository management and test-driven development. I believe that the folks at php[Architect] have a current publication that explores these topics. It's too much to write about in a Q-n-A forum, but it's where you want to spend some time in order to organize your workflow and navigate your way forward.
This link offers a simple and concise explanation. It encompasses a great depth of experience.
http://nvie.com/posts/a-successful-git-branching-model/
Twitter has used a design like this:
twitter.com <-- live site ("production")
www.twitter.com <-- redirects to live site
beta.twitter.com <-- pre-production code branch
dev.twitter.com <-- pre-release code branch
test.twitter.com <-- unit test, developer sandbox, unstable
docs.twitter.com <-- RTFM
help.twitter.com <-- forum, wiki, conversation, etc
Once you begin using Git correctly you will be amazed how easy it is to handle everything related to source code management and testing workflow. In my opinion, this is the greatest advancement in software development since the introduction of object-oriented programming!
ASKER
Thanks everyone! gr8gonzo had the answer i needed for now!
Many huge thanks to Ray for the tip - i'll look into this for the future! It's worth looking into for future use.
Many huge thanks to Ray for the tip - i'll look into this for the future! It's worth looking into for future use.
Similarly, as @gr8gonzo already said, if you create a symbolic link on the server you would need to add the following line to your virtual host .conf (assuming it is not already there)
Open in new window
However, you can simply use a redirect instead in the .htaccess file:
Open in new window
For my money, I'd take the .htaccess route as it offers you the most flexibility. If you want to change it in any way or remove it altogether, you just edit the .htaccess file and the changes will be applied immediately with the next browser request.
If you use either server method, you will have to restart the Apache service after every change before your changes will be reflected in a browser.