What should I do to restrict user access to a directory?
1. Enter the cd / data/www directory
two。 Create a tmp file
Mkdir tmp
What should I do to prevent users from accessing the tmp directory?
1. Open the virtual host configuration file and add code
Vi / usr/local/apache2/conf/extra/httpd-vhosts.conf
RewriteEngine on
RewriteCond% {HTTP_HOST} ^ www.test.com$ [OR]
RewriteCond% {HTTP_HOST} ^ www.aaa.com$-add a row
RewriteRule ^ / (. *) $http://ww.lizheng.com/$1 [Rene301 Magi L] (marked with / beginning, $1)
# Rewritecond% {HTTP_USER_AGENT} ^. * curl.* [NC,OR]
# Rewritecond% {HTTP_USER_AGENT} ^. * chrome* [NC]
# Rewritecond. *-[F]
Rewritecond% {REQUEST_URI} ^. * / tmp/.* [NC] condition
RewriteRule. *-[F] rejected as a result
two。 Restart, load
Apachectl-t
Apachectl graceful
3. test