Working with symlinks in apache
ln -s /var/www/mysites /home/storage/mysites
I want to store some websites outside of /var/www by using a symlink. To make that work, I had to set chmod o=x permission for all parent directories of the target path.
chmod o=x /home
chmod o=x /home/storage
chmod ug=rwx,o=x /home/storage/mysites
chown -R www-data:www-data /home/storage/mysites
After that, the sites started to work correctly.
https://superuser.com/a/819999/594216
Enable .htaccess for Apache Server
Edit file: /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo service apache2 restart
---------------------
CREATE .htaccess
# put this file in restricted folder and create user/password file by
# htpasswd -c /media/data/Belgelerim/AYARLAR/linux/server/pswd username
# .htaccess processing should be allowed in apache config... To do this add "AllowOverride AuthConfig" to related <Directory> . for example:
#<Directory /var/www/html/test>
# AllowOverride AuthConfig
#</Directory>
AuthName "Secure Area"
AuthType Basic
AuthUserFile /media/data/Belgelerim/AYARLAR/linux/server/pswd
require valid-user