把首页页地址绑定子目录的方法实例

本文介绍如何使用Apache配置文件实现子目录的域名映射,通过修改RewriteEngine及RewriteRule等指令来实现特定子目录的访问绑定。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

RewriteEngine on
# 把 m.witmax.cn 改为你要绑定的域名.
RewriteCond %{HTTP_HOST} ^(http://)?localhost$
 
# 把 subdir 改为要绑定的目录.
RewriteCond %{REQUEST_URI} !^/orderfood/
 
# 不要改以下两行.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
 
# 把 subdir 改为要绑定的目录.
RewriteRule ^(.*)$ /orderfood/$1
 
# 把 m.witmax.cn 改为你要绑定的域名
# 把 subdir 改为要绑定的目录.
# subdir/ 后面是首页文件index.php, index.html……
 
RewriteCond %{HTTP_HOST} ^(http://)?localhost$
RewriteRule ^(/)?$ orderfood/index.php [L]




http://witmax.cn/apache-domain-subdir.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值