February 7th, 2008
.htaccess 实用范例
以下为常用范例
在不改动 php.ini 及 httpd.conf 便设定服务器变数:
关闭 magic_quotes_gpc
# Only if you use PHP
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>
减少 Bandwidth 使用量
# Only if you use PHP
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>
变更 scripts 副档名
AddType application/x-httpd-php .php4
以上语句会将 .php4 当成 PHP 程式编译。
禁止 .htaccess 开放浏览
<files file-name>
order allow,deny
deny from all
</files>
变更预设页面
DirectoryIndex myhome.htm index.htm index.php
自订错误页面
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html
开放/禁止浏览目录
# 禁止
Options All -Indexes
# 开启
Options +Indexes
[via:Real-Blog]
About
Contact
Entries Rss (2.0)




随机文章
相关文章
Add a Comment: