【问题标题】:wildcard sub-domain on localhost using codeigniter使用 codeigniter 在 localhost 上的通配符子域
【发布时间】:2018-11-01 13:34:10
【问题描述】:

我已经使用 codeigniter 在我的本地主机上设置了虚拟主机,它工作正常。但我无法创建通配符子域。下面添加虚拟主机是我在windows机器上的步骤。

C:\Windows\System32\drivers\etc\hosts.txt

在这个host.txt中我添加了下面的行

127.0.0.1           localhost.com

我正在使用 xampp 。我在 httpd-vhosts.conf 文件中添加了以下行。 D:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost localhost.com:80>
    DocumentRoot "D:/xampp/htdocs/adeptra"
    ServerName localhost.com
    ServerAlias localhost.com

    <Directory "D:/xampp/htdocs/adeptra">
        Options Indexes FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/adeptra"
    ServerName localhost.com
    ServerAlias *.localhost.com
<Directory "D:/xampp/htdocs/adeptra">
        Options Indexes FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>

下面是我删除 index.php 的 .htaccess 代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

所以现在我的问题是,真的可以在 localhost 中创建通配符子域吗?如果是,那么请在这方面帮助我。任何帮助将不胜感激。

【问题讨论】:

    标签: codeigniter localhost subdomain wildcard


    【解决方案1】:

    here 已经提出并回答了类似的问题。基本上,不,您不能在 localhost 上创建子域。您需要创建链接答案中解释的本地域。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-05
      • 2011-06-05
      • 2017-01-05
      • 2020-07-23
      • 2011-08-15
      • 2017-05-18
      • 2013-02-16
      • 2015-11-04
      相关资源
      最近更新 更多