如何在codeigniter项目中从url中删除index.php
我正在用Codeigniter创建一个网站。我知道这是一个非常常见的问题,关于堆栈溢出有很多解决方案。我几乎都试过了,但没有一件对我有帮助 我只想从我的url中删除index.php。谁能告诉我怎么做 我已经从配置文件的如何在codeigniter项目中从url中删除index.php,php,codeigniter,Php,Codeigniter,我正在用Codeigniter创建一个网站。我知道这是一个非常常见的问题,关于堆栈溢出有很多解决方案。我几乎都试过了,但没有一件对我有帮助 我只想从我的url中删除index.php。谁能告诉我怎么做 我已经从配置文件的$config['index\u page']部分删除了index.php 我还检查了$config['uri_protocol']='AUTO'模式尝试自动模式和请求URI模式 我现在的.httaccess文件结构如下: <IfModule authz_core_modu
$config['index\u page']
部分删除了index.php
我还检查了$config['uri_protocol']='AUTO'代码>模式尝试自动模式和请求URI模式
我现在的.httaccess文件结构如下:
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
要求全部拒绝
全盘否定
重新启动发动机
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L,QSA]
谁能告诉我怎么做 $config['uri\u protocol']
应该是REQUEST\u uri
,然后是.htaccess
,如下所示
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
$config['uri\u protocol']
应该是REQUEST\u uri
,然后是.htaccess
,如下所示
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我有以下几点,对我来说很好:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
我有以下几点,对我来说很好:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
按如下方式更改配置文件:
$config['index_page']='';
$config['uri_protocol']='AUTO'代码>
使用以下.htaccess:
重新编写引擎打开
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L,QSA]
注意:.htaccess
因服务器而异。在某些服务器(例如:Godaddy)中,需要使用以下.htaccess
:
重新编写引擎打开
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L,QSA]
按如下方式更改配置文件:
$config['index_page']='';
$config['uri_protocol']='AUTO'代码>
使用以下.htaccess:
重新编写引擎打开
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L,QSA]
注意:.htaccess
因服务器而异。在某些服务器(例如:Godaddy)中,需要使用以下.htaccess
:
重新编写引擎打开
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L,QSA]
试试这个
RewriteEngine On
RewriteBase /music
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
重写Base/music是你的文件夹名试试这个
RewriteEngine On
RewriteBase /music
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
重写Base/music是您的文件夹名=>配置文件中的更改:-
$config['base_url'] = 'http://123456/proj/';
$config['index_page'] = '';
=>在.htaccess文件中的更改:-
RewriteEngine on
RewriteCond $1 !^(index\.php|
(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
=>配置文件中的更改:-
$config['base_url'] = 'http://123456/proj/';
$config['index_page'] = '';
=>在.htaccess文件中的更改:-
RewriteEngine on
RewriteCond $1 !^(index\.php|
(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
不工作,看这里,这不是打开这是打开不工作,看这里,这不是打开这是打开不工作,看这里,这不是打开这是打开但不工作,我非常想要它的解决方案。我尝试了几乎所有的方法,但我无法删除索引。phpnot不工作,请看这里这不是打开这是打开添加但不工作,我非常想要它的解决方案。我尝试了几乎所有的方法,但我无法删除索引。php@RiggsFolly你能更新你的链接吗?现在你会发现旧的和新的用户指南都不涉及CImore@wolfgang1983好的,谢谢你的信息。遗憾的是,搜索引擎似乎没有赶上这一点change@RiggsFolly你能更新你的链接吗?现在你会发现旧的和新的用户指南都不涉及CImore@wolfgang1983好的,谢谢你的信息。遗憾的是,搜索引擎似乎没有跟上这一变化。。没有什么问题.httaces文件在应用程序文件夹中,我现在把它放在项目的根文件夹中,它对我来说很有用,谢谢。。没有什么问题。httaces文件在应用程序文件夹中,我现在把它放在项目的根文件夹中,它为我工作,谢谢