【问题标题】:Codeigniter send email error 404 on web pageCodeigniter 在网页上发送电子邮件错误 404
【发布时间】:2017-01-27 19:25:14
【问题描述】:

我正在测试一个 web 示例...我在这个方向上创建了一个联系表单,您可以尝试发送电子邮件,然后查看 inspect-console 或 inspect-network:

http://www.novaderma.cl/site2/

它给出错误 404,“在此服务器上找不到请求的 URL”...我不知道发生了什么...这是 .htacces 文件,请帮助我!!

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

【问题讨论】:

  • 您的虚拟主机是否设置了AllowOverride All(假设您使用的是 Apache)?
  • 对不起,我不明白你的意思......我应该在哪里找到这个?
  • 您在使用共享主机吗?您是否可以通过 ssh 访问您的服务器?

标签: php .htaccess email http-status-code-404 codeigniter-3


【解决方案1】:

在根目录的htaccess文件中添加这个重写规则

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # Rewrite all other URLs to index.php/URL
    RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 

</IfModule>

也在codeigniter Config文件夹-> autoload.php文件中添加url helper:

$autoload['helper'] = array('url');

【讨论】:

  • TY!!!!!!!!!!!!!!!!!!伙计,我有这个问题将近 3 天......你是一个英雄!干杯!!
  • 如果会话有问题,则自动加载 $autoload['libraries'] = array('database','session');
【解决方案2】:

你必须在你的 htaccess 文件中使用下面的代码...

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase //
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

【讨论】:

  • 不只是提供代码,您能否解释一下这如何以及为什么解决了 OP 的问题?
猜你喜欢
  • 2015-03-17
  • 2016-05-06
  • 2016-09-02
  • 2013-03-28
  • 2013-01-07
  • 2019-08-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多