首页 文章

如何重新配置从在线Linux服务器获取的CodeIgniter站点以在localhost服务器上工作

提问于
浏览
0

该网站最初是在Linux服务器上,我得到了该网站和.sql数据库的副本 .

我开始尝试为XAMPP重新配置它 .

在CodeIgniter中,我将database.php文件更改为具有正确的主机名,用户名,密码和数据库 . 然后我将base_url更改为该站点的localhost根URL .

这导致css正确显示登录页面,使其看起来就像在线一样 . 但是,当我尝试使用我在线使用的相同用户名和密码登录时,它将我重定向到http://localhost/xampp/而不是网站的主页 .

当我输入错误的用户名或密码时,它会显示错误消息,但是当我输入正确的用户名和密码时,它会将我重定向到XAMPP页面,这意味着数据库连接正在运行 .

我尝试使用ubuntu虚拟机服务器的相同类型的东西,它甚至没有识别base_url来正确显示css .

什么会导致网站重定向到XAMPP页面,如何重新配置它以允许我登录到主页?我是否必须创建一个全新的网站并将所有代码和文件零碎地传输到其中?如果是这种情况我还需要遗漏什么?

1 回答

  • 0

    我追求关于.htaccess文件的建议,但是我没有从实时服务器获取文件,而是在.htaccess文件中使用了以下代码,并将应用程序文件夹中的.htaccess文件更改为CI的默认语句 .

    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    RewriteBase /base_name_of_site/
    # If your project is in server root then should be: RewriteBase /
    # If project is in folder then it should be: RewriteBase /folder_name/
    
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    <IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
    </IfModule>
    

    登录现在有效,我现在可以访问和编辑本地服务器上的整个站点 . 谢谢 .

相关问题