尝试与我的网站交互时,我不断收到服务器 404 错误: http://www.interjo.in/
我的.htaccess文件如下:
RewriteEngine On
# First add the www to URL
RewriteCond %{HTTP_HOST} ^interjo.in$ [NC]
RewriteRule ^(.*)$ http://www.interjo.in/$1 [L,R=301]
# The remove the index.php from URL
RewriteCond $1 !^(index\.php|ref_doc|media|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
在我的配置文件中,这些是前几个选项:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://www.interjo.in/';
/*
|--------------------------------------------------------------------------
| 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 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
出于某种原因,只有当我在末尾添加
/index.php?/signup
时,注册页面才会显示,请参阅此处:
https://www.interjo.in/index.php?/signup
但是如果我在没有index.php的情况下输入它,它会显示404错误代码,如下所示: https://www.interjo.in/signup
我不明白为什么要这样做; codeigniter 2 不应该发现我在没有额外的
/inedx.php?/
的情况下调用“注册”控制器吗?
我通过 docker(通过网络站和容器管理器)将其托管在我的 Synology NAS 上
您的 RewriteRule 似乎不起作用。 要检查它,请尝试将
index.php/$1
更改为 test.php/$1
,添加一个名为 test.php
且包含 <?php echo 'in test.php';
的文件。
如果您打开 https://www.interjo.in/signup 并且没有看到“in test.php”,则证明您的 Apache 配置或 .htaccess 存在问题。 如果它确实有效,那么你的问题就出在其他地方。