使用XAMP在localhost上运行多个站点时出现问题

时间:2015-05-07 18:45:06

标签: apache codeigniter xampp codeigniter-2

我有两个codeigniter项目accounting.local和acc.local使用xamp在我的localhost上托管。项目accounting.local和acc.local都包含相同的文件(代码)。我目前正在做的是编辑其中一个项目并检查已编辑和未编辑的应用程序版本之间的更改。该应用程序的第一页是登录页面。从" http://accounting.local"我降落在

http://127.0.0.1/accounting/login/home_main

从" http://acc.local"登录时它不是登录系统,而是重定向到" http://accounting.local"的登录页面。

http://127.0.0.1/accounting/login

我预计它会降落在

http://127.0.0.1/acc/login/home_main

我不确定问题的来源。如果有人有类似的问题或解决方案,请告诉我。以下是两个项目的设置: acc.local / route.php

$route['default_controller'] = "login";
$route['404_override'] = 'login/home';

accounting.local / route.php

$route['default_controller'] = "login";
$route['404_override'] = 'login/home';

虚拟主机设置:

    <VirtualHost accounting.local>
  DocumentRoot "C:/xampp/htdocs/accounting"
  ServerName accounting.local
  CustomLog "C:/xampp/htdocs/accounting/logs/accounting.local.access.log" combined
  ErrorLog "C:/xampp/htdocs/accounting/logs/accounting.local.error.log"

  <Directory "C:/xampp/htdocs/accounting">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost acc.local>
  DocumentRoot "C:/xampp/htdocs/acc"
  ServerName acc.local
  CustomLog "C:/xampp/htdocs/acc/logs/acc.local.access.log" combined
  ErrorLog "C:/xampp/htdocs/acc/logs/acc.local.error.log"

  <Directory "C:/xampp/htdocs/acc">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

application / config.php中的基本网址设置

    $config['base_url'] = 'http://127.0.0.1/acc/'; //acc.local
$config['base_url'] = 'http://127.0.0.1/accounting/';//accounting.local

用户登录控制器对于两个项目都是相同的。控制器/ login.php中

function user_login()
{
    if(isset($_POST['enter']))  //Login button pressed
    {
        $data = $_POST;
        $check = $this->login_model->login_match($data);

        if($check)
        {
            redirect('login/home_main');
            // redirect('login/home');
        }....

Windows系统托管文件设置:

localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
::1             localhost
127.0.0.1 saseco.local
127.0.0.1 accounting.local
127.0.0.1 acc.local

我不太确定问题所在,所以我已经包含了codeigniter设置以及xamp服务器设置。

0 个答案:

没有答案