php - 在 xampp localhost 中使用 PHP 和 htaccess 创建动态子域

标签 php mysql apache .htaccess mod-rewrite

如何在 xampp localhost 中使用 PHP 和 htaccess 创建动态子域 我在 mysql 中存储了子域名,但我想在窗口平台的 xampp localhost 中进行如下检查

是指 http://example.com/subdomain?=alabaster

我想要这样 http://alabaster.example.com 通过本地主机 xampp 中的 php mysql 你会逐步解释吗

如何在本地主机 xampp 窗口中运行它

比x提前

最佳答案

你可以试试这段代码:

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^subdomain=([^&]+)$
RewriteRule ^$ http://%1.example.com?  [L,R=301]

这些链接可能对您有帮助:

关于php - 在 xampp localhost 中使用 PHP 和 htaccess 创建动态子域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34694232/

相关文章:

php - 显示用户名可用,即使已经存在

.net - 我如何禁止整个公司访问我的网站?

mysql - 需要使用两个不同的where子句返回两组数据

php - 如何获取所有评论过帖子的用户?

php - 在网页上显示 mysql 表的每一行正在运行的 "time since"

php - 在 SQL 中从另一个表更新一个表的最佳方法是什么?

php - SPHINX 搜索引擎上的 enable_star 不工作

apache - 如何在使用 mod_proxy 的同时将用户发送到 Apache 中的另一个 "site"?

Java Apache POI FINE_DOTS 无法解析或不是字段

apache - .htaccess 中单个 RewriteCond 的多个 RewriteRules