【问题标题】:Codeigniter base_url in pleskplesk 中的 Codeigniter base_url
【发布时间】:2018-11-08 00:32:12
【问题描述】:

最近我上传了一个使用codeigniter框架创建的网站到plesk。在 c-panal 中,我将文档根目录更改为 httpdocs/public_html/cliftonhotel.ae,然后使用 FTP 将文件上传到其中。我将 base_url 更改为

$config['base_url'] = 'http://cliftonhotel.ae/';

问题是如果我输入网址加载正常(主页),但其他菜单不起作用,它们显示 404 page not found 错误。

[http://cliftonhotel.ae/][1] 这是网站。有什么解决办法,谢谢。

【问题讨论】:

  • 在菜单链接中使用 base_url 或 site_url 可以解决您的问题

标签: php codeigniter plesk base-url


【解决方案1】:

做一些改变,希望它的工作 // .htaccess 文件

    RewriteEngine on
    RewriteCond $1 !^(index\.php|public|\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1

// config.php

    $config['index_page'] = ' ';

【讨论】:

    【解决方案2】:

    您创建的链接似乎缺少 index.php

    例如:http://cliftonhotel.ae/index.php/home/about 有效

    http://cliftonhotel.ae/home/about 没有。

    因此您必须更改链接或编辑您的 .htaccess 以进行 url 重写

    【讨论】:

    • 谢谢你的回复,但是我没有在任何地方声明 index.php,那为什么它会这样,编辑我的 .htaccess 意味着删除 index.php 部分???
    • 你不需要在codeigniter中声明index.php。这是它的默认行为。要覆盖此行为,您需要在 .htacces 文件中进行 url 重写。如果你是新手,最好不要动它
    猜你喜欢
    • 2018-07-26
    • 2014-06-01
    • 2012-07-26
    • 2016-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-07
    • 1970-01-01
    相关资源
    最近更新 更多