删除codeigniter中的index.php。我的项目在子文件夹中
我正在尝试删除codeigniter中的删除codeigniter中的index.php。我的项目在子文件夹中,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我正在尝试删除codeigniter中的index.php。我的codegiter项目位于public\u html/programemis/lasoona/中。我有.htacess文件,其中包含以下代码 RewriteEngine on RewriteBase /lasoona/ RewriteCond $1 !^(index.php|resources|robots.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_
index.php
。我的codegiter项目位于public\u html/programemis/lasoona/
中。我有.htacess
文件,其中包含以下代码
RewriteEngine on
RewriteBase /lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
但它不起作用。请任何人帮忙。试试这个:
RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /programemis/lasoona/index.php?/$1 [L,QSA]
网上已经发布了很多解决方案。下面是stackoverflow本身的一些信息: 如果它不起作用,下面是另一个(这对我很有用)基于:
重新启动发动机
RewriteCond%{THE_REQUEST}^GET.*index\.php[NC]
重写cond%{REQUEST_URI}/系统/*[NC]
重写规则(.*)索引\.php/*(.*)/$1$2[R=301,NE,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。*index.php/$0[PT,L]
请注意.htaccess的位置
我使用它并尝试它。如果无法工作,请从RewriteBase中删除programemis文件夹。如果您遇到我建议的相同问题,请创建一个子域
RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
我觉得没问题,你有404吗?您是否定义了
base\u url
?那么$config['index_page']
呢,它是空的吗?好的观点@kisaragi。。。。添加另外一个东西remove QSA$config['index_page']是空的,但仍然不工作index.php/$1
将生成index.php/foo/bar
,除非启用了路径信息,否则它将不是有效的url。也许你想要index.php?$1
?亲爱的@aeonsleo,也试试这个,但它不起作用。
RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]