1

可能重复:
如何删除 codeigniter 路径中的“index.php”

1.在codeigniter目录下创建一个.htaccess文件,代码如下

 <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase /ex/
     RewriteCond $1 ^(application|system|private|logs)
     RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]
     RewriteCond $1 ^(index\.php|robots\.txt|opensearch\.xml|favicon\.ico|assets|forums)
     RewriteRule ^(.*)$ - [PT,L]
     RewriteRule ^(.*)$ index.php/$1 [PT,L]
  </IfModule>

2.并更改config['index_page']='index.php'config['index_page']=''

但它不工作。我的 httpd.conf(/etc/apache2/) 是空白的

4

3 回答 3

1

确保您在 Apache 模块上启用了 rewrite_module

RewriteEngine On
RewriteBase /ex/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
于 2013-02-01T05:39:30.963 回答
0

在你的 .htaccess 文件中试试这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
于 2013-02-01T05:38:07.287 回答
0
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
于 2013-02-01T05:42:08.327 回答