删除CodeIgniter中的index.php

发布于 2024-08-30 20:17:19 字数 708 浏览 1 评论 0原文

我正在尝试从 CI 网址中删除“index.php”。

我尝试了很多解决方案,但没有一个有效。我已经在“config.php”中设置了这些变量:

$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";

我当前的 .htaccess 是:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^plugb.com$ [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [R=301,L]

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

www 前缀部分工作正常。但“index.php”部分没有。如果你想查看网页,这里是: http://www.plugb.com/索引.php/home

I'm trying to remove the 'index.php' from CI Urls.

I've tried many solutions, none of them worked. I've already set these variables in 'config.php':

$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";

And my current .htaccess is:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^plugb.com$ [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [R=301,L]

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

The www prefix part works fine. But the 'index.php' part doesn't. If you want to check the webpage, here is it: http://www.plugb.com/index.php/home

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傾城如夢未必闌珊 2024-09-06 20:17:19

将您的应用程序文件夹从系统文件夹中取出并使用以下代码:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder_name/index.php/$1 [L]

它应该可以工作。

Take your application folder out of the system folder and use this code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder_name/index.php/$1 [L]

It should work.

两相知 2024-09-06 20:17:19

有关如何执行此操作的说明,请参阅 CodeIgniter 用户指南的 URL 部分 “删除index.php 文件”部分。。

There's instructions on how to do this in the URLs Section of the CodeIgniter User Guide under the section "Removing the index.php file".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文