tags:

views:

28

answers:

1

I have some links like this

http://www.domain1.com/files/domain1.com/files/def.jpg

http://super.domain1.com/files/super.domain1.com/files/abc.jpg

http://www.other1.com/files/other1.com/files/uhj.jpg

These websites are hosted in the same hosting and sharing files folder. We separate them by using a sub folder named like domain name of website. However, file which belong to domain1.com:

http://www.domain1.com/files/domain1.com/files/def.jpg

can be reach with url

http://www.other1.com/files/domain1.com/files/def.jpg

How to prevent this?

A: 

Get configure for each domain separately vhost to domain folder.

Example of vhost config i post below.

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName www.domain1.com

        DocumentRoot /home/domains/files/super.domain1.com/

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /home/domains/files/super.domain1.com/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined

</VirtualHost>

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName domain1.com

        DocumentRoot /home/domains/files/super.domain1.com/

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /home/domains/files/super.domain1.com/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined

</VirtualHost>
Svisstack