Rewrite limitations of 7_apache configuration

Source: Internet
Author: User

Some directories are for users who do not need access

For example:

[Email protected] ~]# cd/data/www

[Email protected] www]# mkdir tmp/

[Email protected] www]# CD tmp/

[[email protected] tmp]# ls

[Email protected] tmp]# vim 12.txt

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/4D/wKiom1fuE8zC4og7AACrXCoxML8182.jpg "title=" Dis24.jpg "alt=" Wkiom1fue8zc4og7aacrxcoxml8182.jpg "/>

At this point, the file/data/www/tmp/12.txt is normally accessible.

Now I have a requirement that there are some important files in this folder that you do not want to see for the user.

Or this module, note the Red font part

[Email protected] ~]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf

<ifmodule mod_rewrite.c>

Rewriteengine on

Rewritecond%{http_host} ^www.aaa.com$ [or]

Rewritecond%{http_host} ^www.bbb.com$

Rewriterule ^/(. *) $ http://www.test.com/$1 [r=301,l]

# Rewritecond%{http_user_agent} ^.*curl.* [nc,or] #NC mean not to distinguish the size, the same

Rewritecond%{http_user_agent} ^.*chrome* [NC]

Rewriterule. *-[F]

Rewritecond%{request_uri} ^.*/tmp/.* [NC]

Rewriterule. *-[F]


[Email protected] ~]# apachectl-t

Syntax OK

[Email protected] ~]# apachectl restart

Visit the website again, site 403, no access.

Http://www.test.com/tmp/12.txt

650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M00/88/4E/wKiom1fuG72Cwl1FAADTi7DWr2Q148.jpg " Title= "Dis25.jpg" alt= "Wkiom1fug72cwl1faadti7dwr2q148.jpg"/>

This article is from the "Cbo#boy_linux Road" blog, make sure to keep this source http://20151213start.blog.51cto.com/9472657/1858145

Rewrite limitations of 7_apache configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.