简体   繁体   中英

files and images outside html folder

I have moved website from one hosting to another and due to security, PCI and HIPPA reason, I need to move some (files and images) directories outside html folder.

Previous structure : /public_html/uploads

Current structure : /var/www/uploads

For Files : /var/www/html/

I want to know how I can handle uploaded images and images get to display on front page.

Thanks

You could use symbolic links eg:

in /var/www/html execute ln -s /var/www/uploads image_uploads then all your images can be referenced with <img src="/image_uploads/some_image_name.jpg">

Be aware than you may need to set alternative permissions in a <Directory> section in your site configuration (I am assuming that you are using Apache).

Something like

<Directory "/var/www/uploads">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   allow from all
</Directory>

See the Apache documentation for Directory for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM