【问题标题】:Configure virtual host for different websites with codeigniter使用 codeigniter 为不同的网站配置虚拟主机
【发布时间】:2014-02-28 08:51:42
【问题描述】:

我有一个主门户,现在这个门户将被不同的机构使用。

我的 apache 虚拟主机配置如下:

<VirtualHost *> DocumentRoot "C:/xampp/htdocs/portal/exp1.php" ServerName test.exp1.org <Directory "C:/xampp/htdocs/portal/exp1.php"> Order allow,deny Allow from all </Directory> </VirtualHost>

<VirtualHost *> DocumentRoot "C:/xampp/htdocs/portal/exp2.php" ServerName test.exp2.org.in <Directory "C:/xampp/htdocs/portal/exp2.php"> Order allow,deny Allow from all </Directory> </VirtualHost>

现在您可以看到我创建了不同的索引页面,例如 exp1.phpexp2.php

在每个索引页面中,我只写了这样的东西

header("Location: http://test.exp1.org/exp1.php/login/index/1")
所以现在这将调用登录控制器 -> 索引函数 -> 和参数为 1.. 所以基于这个参数,我将为特定的第一个机构加载相应的登录页面。

其他exp2.php也一样

header("Location: http://test.exp2.org/exp2.php/login/index/1")
所以现在这将调用登录控制器 -> 索引函数 -> 和参数为 2.. 所以基于这个参数,我将为特定的第二机构加载相应的登录页面。

当我在浏览器 http://test.exp1.org/ 上完成所有这些操作后,它向我显示了这个错误 页面没有正确重定向,实际上我希望它加载特定的根据url传入的参数查看。

这是我的文件夹结构

知道我是我的错误或我应该执行的所有步骤以正确重定向

【问题讨论】:

    标签: php apache http-headers virtualhost codeigniter-url


    【解决方案1】:

    我不熟悉 CodeIgniter(我使用 Laravel),但对我来说,这似乎是 apache 配置不正确。

    这是我在 httpd-vhost.conf 上使用的配置(示例):

    <VirtualHost nudistbeach.com:80>
        ServerAdmin webmaster@nudistbeach.com
        DocumentRoot "C:/wamp/www/nudistbeach/public/"
        ServerName nudistbeach.com
        ErrorLog "logs/test-laravel-error.log"
        CustomLog "logs/test-laravel-access.log" common
    </VirtualHost>
    
    <VirtualHost revocs.com:80>
        ServerAdmin webmaster@revocs.com
        DocumentRoot "C:/wamp/www/revocs/public/"
        ServerName revocs.com
        ErrorLog "logs/test-laravel-error.log"
        CustomLog "logs/test-laravel-access.log" common
    </VirtualHost>
    

    尝试这样做并告诉我结果:

    <VirtualHost test.exp1.org:80>
        ServerAdmin webmaster@test.exp1.org
        DocumentRoot "C:/xampp/htdocs/portal/exp1.php"
        ServerName test.exp1.org
        ErrorLog "logs/test-laravel-error.log"
        CustomLog "logs/test-laravel-access.log" common
    </VirtualHost>
    
    <VirtualHost test.exp2.org:80>
        ServerAdmin webmaster@test.exp2.org
        DocumentRoot "C:/xampp/htdocs/portal/exp2.php"
        ServerName test.exp2.org
        ErrorLog "logs/test-laravel-error.log"
        CustomLog "logs/test-laravel-access.log" common
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-17
      • 2015-06-19
      • 2017-05-27
      • 1970-01-01
      • 2014-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多