比如说,想要保护admin文件夹,经过以下两个步骤:
步骤一、可以用记事本新建文件.htaccess,输入以下内容:
AuthType BasicAuth
UserFile D:/AppServ/www/Hill/admin/.htpasswd
AuthName “hill”
require valid-user
各行不多解释,关键是第二行,一定要是绝对路径,表示.htpasswd文件的位置。(位置任意)
然后把这个名为.htaccess的文件放到admin文件夹中。
步骤二、下面就是新建一个名为.htpasswd的文件,名字应该和上面第二行一致。
简单的方法:开始-运行-cmd-apache>bin\htpasswd -c .htpasswd name
下面就是输入密码了,是经过md5加密的。
建好后把这个名为.htpasswd的文件放到第二行指定的位置处。
再次说明一下UserFile第二行,花了我好长时间才弄好,如果提示500错误就是路径不正确。对于atbhost空间的位置是/home/注册名。
atbhost空间提供了存放密码的地方:.htpasswds
把你的.htaccess文件保护起来
.htaccess太强大了,但它本身会不会被破解掉呢,请问如何保护它?
答:在使用.htaccess来设置目录的密码保护时,它包含了密码文件的路径。从安全考虑,有必要把.htaccess也保护起来,不让别人看到其中的内容。虽然可以用其他方式做到这点,比如文档的权限。不过,.htaccess本身也能做到,只需加入如下的指令:
复制代码 代码如下:
order allow,deny
deny from all

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version
God-level code editing software (SublimeText3)
