<-
Apache > HTTP Server > Documentation > Version 2.4 > How-To / Tutorials

9 � 府 .htaccess /h1>
巩 5 � 5辟 蟀� �) 巩 � 曼� .

.htaccess � �) 府 � � 蟀�

top

.htaccess /a>

top

公4哥/�� �) �

.htaccess � "� � ) �) � 府 � � 蟀� � � � � � 巩 府 � � 府 葛 府 � �

林 :

.htaccess � じ�� �) � �涓�, AccessFileName � �) 蟀� � � .config � �) じ� � �< � � � 6�

AccessFileName .config

�� .htaccess林$ /a>� 巩 � AllowOverride � � �) 搬 � .htaccess � � ' ��� ' � .htaccess � �) じ�, � ' 巩 Override �� � � 扁 AllowOverride �) � �

� � AddDefaultCharset ' 巩 � 焊搁 � .htaccess � �) (' � �)% �� 焊 ) Override $ FileInfo� 弊 � .htaccess � �) 扁4 5 AllowOverride FileInfo�

:

�)% : 林 亥 , 凹$ directory, .htaccess
Override: FileInfo

� � .htaccess � �) ' ��� ' 巩 �)% �� ".htaccess"� ' �

top

� .htaccess � �) (� �) ' )

�� 林 涵 辟 版0 几� .htaccess � �) � � � �) � .htaccess � � � � � � � � � �$ 林 亥 �) � � �, � �毂� �

.htaccess � 牧 8 傍 � 府 � � � じ��� � � � � root � 版0 �) � 锤� � � # 蟀� � � 版 � �) � ' .htaccess � � � � �' � � 哪 � � � �) �4 � 湖 ISP �) � � 蟀� � � 版0 弊�

弊� �� .htaccess � �� � � .htaccess � � � 林$< � � � ���

� �' � 巩 .htaccess �) � �

霉 掳 ��4 AllowOverride� .htaccess � �) � � � 9 府 .htaccess � 茫 弊 .htaccess � � � � � � �) ' 版0 �� �4 , .htaccess � 巩 � 2� �4�8

 � � 2 � 葛<扁 9 葛 府 .htaccess � 茫 (�� � � 曼 .) 弊 /www/htdocs/example 府 � 2� 9 � �� 茫

/.htaccess
/www/.htaccess
/www/htdocs/.htaccess
/www/htdocs/example/.htaccess

弊 � 府 � 辟 � �< � �$ 4� 辟 � (/ .htaccess � � 版0 � 焊 � � ' )

�' � 焊4 �) � 亥 �� � 林搁 � 敖 �� �4 �) � � � $' 磅磅 � , �) � 埠� � 林搁 扁 '2 �4( �) � �% � $ � � �) � AllowOverride� �� � ' 府 � 巩 � 傍 � � � �

/www/htdocs/example.htaccess � �� 林 亥 Directory � � �

/www/htdocs/example .htaccess � :

/www/htdocs/example .htaccess � /h3>

AddType text/example .exm

apache2.conf � �


AddType text/example .exm

弊� � 2 � � � � 9� �� � 奖夤� � � 亥< �) � �� �

AllowOverridenone� � � .htaccess � �)

AllowOverride None

top

�� � �

.htaccess � 鸢� 府 � 府 葛 府 .htaccess � � � � 弊 府 .htaccess � 林4 鸢� � � � � 府 .htaccess � 府 .htaccess � � 公 � � �, 府 � � � 林$< � 公 � �

:

/www/htdocs/example1 府 � � � .htaccess

Options +ExecCGI

(林 : .htaccess � "Options" � �) じ� "AllowOverride Options"� )

/www/htdocs/example1/example2 府 � � � .htaccess

Options Includes

�' .htaccessOptions Includes� � � 公 � 概扁巩 /www/htdocs/example1/example2 府 CGI � � '

top

� 规 扁 �� 窗�� �涓� 林 � � じ� .htaccess � � � � � �8 � �$ 林$< � � � � � 规� , � 林$< 版0 � .htaccess � �) � � .htaccess � �) � ' �) ' � '

�'� ' .htaccess � � �� � 

.htaccess

AuthType Basic
AuthName "Password Required"
AuthUserFile /www/passwords/password.file
AuthGroupFile /www/passwords/group.file
Require Group admins

� 扁4 AllowOverride AuthConfig � � 阁

� � 督� � � � � 府 /a> 焊辨 �

top

Server Side Includes

じ� � .htaccess � � � 府 Server Side Includes� �% � �  府 .htaccess � � � � � � �) �

Options +Includes
AddType text/html shtml
AddHandler server-parsed shtml

� じ� AllowOverride Options AllowOverride FileInfo� 葛 � 阁

server-side includes � � SSI � 府 /a> 焊辨 �

top

CGI

�'裹 .htaccess � �) � 府 CGI 岜� � � � �涓�, � � � � �)

Options +ExecCGI
AddHandler cgi-script cgi pl

� 府 葛 � CGI 岜��< 2府 � �涓� � � � � �%

Options +ExecCGI
SetHandler cgi-script

� じ� AllowOverride Options AllowOverride FileInfo� 葛 � 阁

CGI 岜� �� � � � CGI � 府 /a> 焊辨 �

top

巩4搬

.htaccess � � � 扁� ' 版 �� ' � �

� � 巩 � � �% � � AllowOverride� � ' 版0 巩 � AllowOverride None ' � .htaccess � 公 � � � � � 辟 � 斑 春� � � � � 几� 芭 � AllowOverride None �) 版0

�� 巩 辟 � � � �� 9 � 岜� � � � .htaccess � � � ' �  � 巩 � � じ� � � �9

�% � 爀n� | 爁r� | 爅a� | 爇o� | 爌t-br�

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.