Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is probably a pretty basic question but I need help.

I am running a LAMP settup, actually using teh Xampp package on a windows system for my development server and my main project I have been coding for over a year now is in the root directory on my dev server which is c:\server\htdocs\

I know most people setup subfolders in there root directory which simplifies what I am wanting to do but I wasn't sure how to go about this, my main project is in my root folder instead of a sub folder, which means if I create sub folders for other projects, then they get cluttered in with my main project folders and files, so is there an easy way that I should be able to move my whole main project into a sub-folder and still access it at http://localhost/ instead of http://localhost/the-sub-folder-name/ ?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You need to edit your httpd.conf file, I'm not sure where Xampp keeps it so you'll have to look around for it. Inside you want to look for a line that says:

DocumentRoot "C:\server\htdocs"

and change it to the subdirectory that you are going to point at, from your example this would be:

DocumentRoot "C:\server\htdocs\the-sub-folder-name"

Please take note that there isn't a trailing slash on the pathname.

While not necessary you might also want to look at the permissions for the folder, if the new folder is located in the old root it won't be an issue but if you want to move it elsewhere you will want to change the matching <Directory> directive. It will look something like this:

<Directory "C:\server\htdocs">
Options Indexes FollowSymLinks
AllowOveride all
Order allow,deny
Aloow from all
</Directory>
share|improve this answer
add comment

EDIT: Just realised it was a Windows setup. Well, some of the tips here might still come in handy.

You can for example, modify your hosts file to include something like this:

127.0.0.1   a.example.com
127.0.0.1   b.example.com

Then use VirtualHosts on your webserver to ensure that a.example.com and b.example.com loads software from different web roots.

However, you could consider using some VM instead.

I have found light-weight virtualisation to be very useful for development. You can run clean installations to test out your software. This may be particularly useful for development when you want to be in control of your dependencies.

Also, you can quickly destroy and create test machines as and when you need to. You can also run multiple VM servers and have your application work across them.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.