Home > Backend Development > PHP Tutorial > 求apache rewrite 无限二级域名的步骤

求apache rewrite 无限二级域名的步骤

WBOY
Release: 2016-06-13 10:35:25
Original
1291 people have browsed it

求apache rewrite 无限二级域名的方法
RewriteCond %{HTTP_HOST} ^[a-z0-9\-]+\.xxx\.net$
RewriteRule ^/?$ /%{HTTP_HOST}
RewriteRule ^/([a-z0-9\-]+)\.xxx\.net/?$ /index.php?app=$1

这是网上找的 二级域名可以使用 也就是当地址栏里输入 bbb.xxx.net 时 实际执行的是 www.xxx.net/index.php?app=bbb

但当URL是bbb.xxx.net/index.php?ac=111&a=222&b=333 rewrite规则怎么样才能使其变成 www.xxx.net/index.php?app=bbb&ac=111&a=222&b=333

求具体的规则

------解决方案--------------------
RewriteRule ^/([a-z0-9\-]+)\.xxx\.net/index\.php\?(.*?)$ /index.php?app=$1&$2

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template