求一个apache+泛域名解析重写规则

heguowei 2010-12-24 10:46:06
现在要实现
其中xxxx代表 任意数字
shopxxxx.host.com => www.host.com/shop/index.php?id=xxxx
shopxxxx.host.com/news-xxxx.html => www.host.com/shop/news.php?id=xxxx

急用,谢谢了。
...全文
64 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
icy_csdn 2010-12-27
  • 打赏
  • 举报
回复

<VirtualHost *:80>
ServerName host.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^shop([0-9]+)\.host\.com$
RewriteRule ^/$ http://www.host.com/shop/index.php?id=%1 [P,L]
RewriteRule ^/news-([0-9]+)\.html$ http://www.host.com/shop/news.php?id=$1 [P,L]
</VirtualHost>
Mr-Jee 2010-12-24
  • 打赏
  • 举报
回复
shop(\d+)\.host\.com$
www.host.com/shop/index.php?id=$1


shop(\d+)\.host\.com/news-\1\html$
www.host.com/shop/news.php?id=$1
tian_he_wang 2010-12-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 cj205 的回复:]

shop(\d+)\.host\.com$
www.host.com/shop/index.php?id=$1


shop(\d+)\.host\.com/news-\1\html$
www.host.com/shop/news.php?id=$1
[/Quote]



YES!!

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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