apache 虚拟主机访问上层目录

miaodabiao 2009-08-25 09:10:21

例如:域名
www.example.net 指向 /www/example
test.example.net 指向 /www/example/test
存在 /www/example/images/1.jpg
存在 /www/example/test/index.php
index.php的内容为:<img src="/images/1.jpg">
我的目的是test.example.net访问index.php显示上一级images目录的1.jpg
配置文件http.conf如下:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example
ServerName www.example.net
ServerAlias *.example.net
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/www/example/vhost.map
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1
</VirtualHost>
配置文件"/www/example/vhost.map"如下:
test.example.net /test
...全文
93 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧