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.

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)
websiteA/edit/

websiteB/index.php (etc)
websiteB/edit/

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:

<VirtualHost 00.00.00.00:80>
DocumentRoot /var/www/html/websitea.com
ServerName www.websitea.com
ServerAlias websitea.com
DirectoryIndex index.htm index.php
CustomLog logs/websitea combined
</VirtualHost>

Is it possible to create an alias inside that directive for the folder websitea.com/edit ?

share|improve this question
add comment

1 Answer

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
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.