【问题标题】:create dynamic sub domain using PHP & htaccess in xampp localhost在 xampp localhost 中使用 PHP 和 htaccess 创建动态子域
【发布时间】:2016-04-14 03:36:31
【问题描述】:

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

表示 http://example.com/subdomain?=alabaster

我想要这样 http://alabaster.example.com 通过 php mysql 在 localhost xampp 你会一步一步解释吗

如何在 localhost xampp 窗口中运行它

提前结束

【问题讨论】:

  • 您的意思是http://example.com/subdomain?=alabaster 还是您的意思是http://example.com/?subdomain=alabaster 的错字?

标签: php mysql apache .htaccess mod-rewrite


【解决方案1】:

你可以试试这个代码:

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

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

【讨论】:

    猜你喜欢
    • 2017-01-05
    • 1970-01-01
    • 2015-10-09
    • 2011-08-21
    • 2010-10-09
    • 2012-12-17
    • 2020-05-12
    • 2011-10-28
    相关资源
    最近更新 更多