且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除index.php代码符号

更新时间:2023-02-23 13:07:38

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

在您的htaccessework中写这个
选中此链接以启用
的mod_rewrite功能安装设置


I really can't find a way to make my .htaccess work and eliminate the /index.php/ part from my localhost site's url: http://localhost/ci_intro/index.php/home/

From XAMPP/xamppfiles/htdocs/ci_intro/application/config/ routes.php :

$route['default_controller'] = 'home';
$route['404_override'] = '';

from XAMPP/xamppfiles/htdocs/ci_intro/application/config/ config.php :

$config['base_url'] = 'http://localhost/ci_intro/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

from XAMPP/xamppfiles/etc/ httpd.conf :

LoadModule rewrite_module modules/mod_rewrite.so

 ...

<Directory "/Applications/XAMPP/xamppfiles/htdocs">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted
</Directory>

mod_rewrite.so is working, I've checked it with a phpinfo()...

from XAMPP/xamppfiles/htdocs/ci_intro/ .htaccess :

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ci_intro/

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

Any ideas? Please I really need help here, thanks!

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

write this in your htaccess
check this link to enable mod_rewrite function of apache setting