删除的index.php codeigniterindex、php、codeigniter

2023-09-02 11:40:50 作者:辞旧.

我实在无法找到一个办法让我的.htaccess工作,消除/index.php/部分从我的本地网站的网址:的http://本地主机/ci_intro/index.php/home /

从XAMPP / xamppfiles / htdocs中/ ci_intro /应用/配置/ routes.php文件

  $航线['default_controller'] ='家';
$路线['404_override'] ='';
 

这是XAMPP / xamppfiles / htdocs中/ ci_intro /应用/配置/ 的config.php

  $配置['BASE_URL'] ='的http://本地主机/ ci_intro /';
$配置['index_page'] ='';
$配置['uri_protocol'] ='自动';
 

这是XAMPP / xamppfiles的/ etc / 的httpd.conf

 的LoadModule rewrite_module模块/ mod_rewrite.so

 ...

<目录/应用程序/ XAMPP / xamppfiles / htdocs目录>
    选择指标的FollowSymLinks ExecCGI包括
    设置AllowOverride所有
    要求所有批准
< /目录>
 
如何在服务器搭建PHP站点

mod_rewrite.so是工作,我曾与一个phpinfo()函数检查的话...

这是XAMPP / xamppfiles / htdocs中/ ci_intro / 的.htaccess

 < IfModule mod_rewrite.c>
    RewriteEngine叙述上
    的RewriteBase / ci_intro /

    的RewriteCond%{REQUEST_URI} ^系统。*
    重写规则^(。*)$ /index.php?/$1 [L]

    的RewriteCond%{REQUEST_URI} ^应用。*
    重写规则^(。*)$ /index.php?/$1 [L]

    的RewriteCond%{} REQUEST_FILENAME!-f
    的RewriteCond%{} REQUEST_FILENAME!-d
    重写规则^(。*)$的index.php?/ $ 1 [L]
< / IfModule>

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

任何想法? 请我真的需要帮助这里,非常感谢!

解决方案

  RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php / $ 1 [L]
 

在你的htaccess 写 检查此链接以启用mod_rewrite的功能 的Apache设置

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