Tutorial :Having latest copy of SVN'ed files in document root


A while back I asked link text and I got some great answers. What I would like to know is if there is a way to keep the files under my web applications document root, and when I make a change, commit them back to the repository.

From what I understand, in order to work on files, they can't be in the web root. Having to move them out to somewhere else just to work on them seems counter-intuitive to me. Am I missing something?



in order to work on files, they can't be in the web root

There's no truth to that. Maybe you're thinking of the fact that files which can be modified/edited by the web server shouldn't be under the document root. But as long as you're not using the server itself to do the editing (which would be the case if, say, you created some kind of text editor web application), it's perfectly fine and a completely normal practice to edit files in the document root.

You might be interested in something like my setup: I have the repository which holds my website on the same physical machine as my web server. One working copy is checked out into the web root on that machine, and I have another working copy checked out on my laptop, where I do my development and testing. Now the fun part: I added a hook to the SVN repository so that every time anything is committed to the repository, it automatically updates the working copy in the web root. This way the web root always has the latest revision of the website code, but I can still work on the site without having access to the server.

EDIT: here's the script


Just check out the svn repo to a directory and make that directory the web root. You will want to have an apache policy that will not serve the .svn directory but other than that there is no issue.

This is what I have in my httpd.conf to protect svn directories:

#Protect svn directories
<DirectoryMatch "^/.*/(\.svn|CVS)/">
Order deny,allow
Deny from all

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »