Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a very simple flat file CMS for small (multilingual) websites. The little file writing that goes on is handled by 4 scripts in a publicly available folder in each site named /edit.

Given that I have 2 websites now working on that simple system:

websiteA/index.php (etc)

websiteB/index.php (etc)

What is the best way of making that /edit folder "virtual" in order that these and each subsequent website owner can login to their view of /edit and yet the code only exists in one place.

I do not want the website owners to have to login from a central website, but from their own /edit directory.

I have already read about different solutions seemingly using the <Directory> directive in my httpd.conf declaration for each website, and also using straight mod_rewrite but admit to now becoming confused about some of the terminology.

Each website has its own config file which contains path settings and so on.

What in your opinion is the best way to handle this?

EDIT In light of a reply, I suppose that given a virtual host directive such as this:

DocumentRoot /var/www/html/
DirectoryIndex index.htm index.php
CustomLog logs/websitea combined

Is it possible to create an alias inside that directive for the folder ?

share|improve this question
up vote 1 down vote accepted

I don't know the exact layout of your code but assuming /var/www/edit/ is the directory that contains the cms scripts then a solution would be to set an alias for it in the main httpd.conf file so that it applies to all vhosts.

Alias /edit /var/www/edit

You also have to add a global section such that all vhosts can execute the scripts in /var/www/edit.

share|improve this answer
Yes, edit is the folder I am concerned with, I will amend my Q. U said "so that it applies to all vhosts." Hmm, I don't think I can risk doing that as there are many other sites on the same server, with traditional CMSs which may contain /edit folders too ... UNLESS I rename /edit to something more memorable? – Cups Nov 7 '12 at 16:20
The only way I can think of is to add the alias directive inside the virtualhost for each website that should use the php scripts if you can not have it global. Which means alias /edit "/path/to/where/edit_folder_that_contains_php_scripts/" – jnvilo Nov 7 '12 at 19:27
Yup, thats the way to do it. Tested and works on my localhost. Nice one jnvilo! – Cups Nov 7 '12 at 20:55

Your Answer


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.