Skip to content

Instantly share code, notes, and snippets.

@lymanlai
Created September 5, 2012 17:28
Show Gist options
  • Save lymanlai/3640610 to your computer and use it in GitHub Desktop.
Save lymanlai/3640610 to your computer and use it in GitHub Desktop.
httdp-addon.conf
#在httpd.conf的最底部添加此代码
#在106行去掉#号,变成:LoadModule rewrite_module modules/mod_rewrite.so
####
## http://lamp.linux.gov.cn/Apache/ApacheMenu/vhosts/mass.html#simple.rewrite
####
# 从"Host:"头获取主机名
UseCanonicalName Off
# 可分拣的日志
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon
<Directory "F:/">
# 这里需要ExecCGI ,因为我们不能强制CGI以与ScriptAlias相同的方式执行
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
</Directory>
# 接下来是关键部分
RewriteEngine On
# 来自"Host:"头的ServerName ,可能大小写混杂
RewriteMap lowercase int:tolower
## 首先处理普通文档
# 开始"变戏法"
RewriteRule ^/(.*)$ F:/${lowercase:%{SERVER_NAME}}/$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment