【问题标题】:Error 404 page cannot be found using XAMPP使用 XAMPP 找不到错误 404 页面
【发布时间】:2021-02-16 05:09:30
【问题描述】:

我正在尝试使用 XAMPP 在域 https://localhost/media.einnovation.com 上托管我的网站,但出现以下错误。

Error Message

我什至尝试进入本地主机的索引并以这种方式访问​​网站,但页面仍然无法加载。

我的网站是使用 CodeIgniter 构建的,并且有一个如下所示的.htaccess 文件。

#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .* index.php/$0 [PT, L]
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#<IfModule mod_rewrite.c>
#    RewriteEngine On
#    RewriteCond %{REQUEST_FILENAME} !-f
#    RewriteCond %{REQUEST_FILENAME} !-d
#    RewriteRule ^(.*)$ index.php/$1 [L] 
#</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]


# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

我的 Apache 和 MySQL 在 XAMPP 控制面板上运行良好,并且都亮了绿灯。

我的 htdocs 文件目录如下所示。

File Directory

我的代码ignitore config.php设置如下。

$config['base_url'] = 'http://media.einnovention.com';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING'   Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';

/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';

谁能找出问题所在?

【问题讨论】:

  • 你设置$config['base_url'] = "https://localhost/media.einnovation.com";
  • @KUMAR XAMPP 文件和文件夹的名称是什么,我可以在其中复制您的建议?
  • config-&gt;config.php
  • @KUMAR 默认我的 $config['base_url'] = 设置为 $config['base_url'] = 'http://media.einnovention.com' ;当我什至将其更改为 $config['base_url'] = 'https://media.einnovention.com';我现在收到错误响应 media.einnovation.com 的服务器 IP 地址找不到。

标签: mysql apache codeigniter xampp


【解决方案1】:

如果您希望站点的基本 URL 为 https://localhost/media.einnovation.com 您需要配置基本 URL $config['base_url'] = "https://localhost/media.einnovation.com";

您还可以在 routes.php 文件中创建一个不同的路由,从 media.einnovation.com 到您想要的控制器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-29
    • 2023-01-29
    • 2013-12-04
    • 2016-12-06
    • 1970-01-01
    • 2014-08-11
    • 2019-01-01
    相关资源
    最近更新 更多