2012-06-13 54 views
-1

我想在godaddy hosting上运行基于codeigniter的投资组合网站。该网站的网址是www.wghclabs.com 该网站在我的本地开发服务器上运行良好(我使用MAMP),但是当使用godaddy我无法实现数据库连接,也无法显示除主页以外的任何页面。 我用htaccess重写了URL。 我尝试了所有我能想到的,我真的迷失在这里......如果有人能指点我在哪里寻找,我会很感激。 这里是我的.htaccess文件的一个副本codeigniter与godaddy设置

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /wghclabs.com/ 

    #Removes access to the system folder by users. 
    #Additionally this will allow you to create a System.php controller, 
    #previously this would not have been possible. 
    #'system' can be replaced if you have renamed your system folder. 
    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #When your application folder isn't in the system folder 
    #This snippet prevents user access to the application folder 
    #Submitted by: Fabdrol 
    #Rename 'application' to your applications folder name. 
    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #Checks to see if the user is attempting to access a valid file, 
    #such as an image or css document, if this isn't true it sends the 
    #request to index.php 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 /index.php 
</IfModule> 

感谢

+0

当它试图连接到数据库时,你会得到什么错误?当你将codeigniter上传到godaddy时,你可能没有更新数据库信息。 – Mythrillic

+0

你有没有改变你的'application/config/database.php'中的数据库设置?特别是'主机名,用户名和密码' –

+0

我认为问题出在你的控制器类上,因为你的视图工作不正常。 –

回答

4

我刚刚主办我的网站上Godaddy.com,所以这就是我所做的,使我的网站的工作:
对于数据库:

  1. 转到商GoDaddy.com
  2. 登录
  3. 转到:主机和服务器 - >主机枭雄 - >虚拟主机 - >启动。
  4. 你现在应该是@控制面板。
  5. 转到:设置 - > MySQL,你会发现你的数据库列表(如果有的话)!
  6. 点击:创建数据库,请注意数据库的名称是您访问它的方式。
  7. 创建数据库后,请参阅数据库的操作列,单击小铅笔。
  8. 现在数据库中的信息是:
    主机名(而不是localhost)XXX.db.XXX.hostedresource.com
    用户名:XXX(而不是root
    和所有你需要的信息,如数据库名称等(预计密码,只需使用您在创建数据库时提供的那个)。
+0

好的感谢问题解决了......我使用我的网址的主机名,而不是godaddy提供的奇怪的主机名。 –

0

我在基于Codeigniter构建的托管应用程序或网站上挣扎着,惊喜的应用程序在localhost上工作,但它不适用于godaddy。

在相同的查询中引用了许多帖子,并找到了常见的解决方案。

变化:的config.php

$config['base_url'] = 'www.example.com'; 
$config['index_page'] = "index.php?"; 

$config['index_page'] = "?"; 

希望这会工作。