Nginx上的Codeigniter remove index.php
我使用的是Codeigniter框架,我在共享主机上测试了该网站,它可以与.htaccess配合使用。但是当我将它上传到另一个拥有Nginx的服务器时,我无法删除index.php。我尝试了googel最初的两个页面,结果都是一样的,没有一个适合我,我想从URL中删除index.php。这就是对我有效的htaccessNginx上的Codeigniter remove index.php,php,.htaccess,codeigniter,nginx,Php,.htaccess,Codeigniter,Nginx,我使用的是Codeigniter框架,我在共享主机上测试了该网站,它可以与.htaccess配合使用。但是当我将它上传到另一个拥有Nginx的服务器时,我无法删除index.php。我尝试了googel最初的两个页面,结果都是一样的,没有一个适合我,我想从URL中删除index.php。这就是对我有效的htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
我想在nginx.config中找到这个htaccess的共同响应。
我不知道有什么问题 这也快把我逼疯了 事实证明,在config.php文件中使用它会有所帮助
$config['uri_protocol'] = 'REQUEST_URI';
我目前也在使用相同的htaccess规则步骤1:转到codeigniter文件夹,打开文件config.php并从$config['index\u page']=''中删除“index.php” 步骤2:在codeigniter文件夹中创建.htaccess文件并粘贴到代码下方
RewriteEngine On
RewriteBase /codeigniter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
或
步骤3:查找
$config['uri_protocol'] = "AUTO"
并替换为
$config['uri_protocol'] = "REQUEST_URI"
也检查
$config['enable_query_strings'] = FALSE;
步骤4:重新启动xampp服务器并检查..尝试此操作以获得更好的解决方案
Step 1: Remove index.php from config.php. Open
/application/config/config.php
and remove index.php to “” ...
Step 2: Edit htaccess file – For Apache Server. NOTE: This step is not for
nginx server users, Please check Step 2 for Nginx. ...
Step 3: Edit nginx.conf file – For NGINX Server.
htaccess在Nginx服务器上不工作。我已经做了$config['uri_protocol']='REQUEST_uri';但问题是你用谷歌搜索了它,那么当你使用result时会发生什么呢?@Tpojka nothing。没有index.php的所有链接。但是在我手动添加index.php之前,它们是不起作用的。您是否尝试在更改后重新启动nginx?
Step 1: Remove index.php from config.php. Open
/application/config/config.php
and remove index.php to “” ...
Step 2: Edit htaccess file – For Apache Server. NOTE: This step is not for
nginx server users, Please check Step 2 for Nginx. ...
Step 3: Edit nginx.conf file – For NGINX Server.