从Wamp中的Codeigniter URL中删除index.php [英] Remove index.php from Codeigniter URL in Wamp

查看:53
本文介绍了从Wamp中的Codeigniter URL中删除index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试从网址的网址中删除index.php时遇到了大问题。

I have big problem trying to remove index.php from url's

我在论坛上搜索了很多(这也是),但对我的情况没有帮助。

i have searched lots if forums (this also), but no help for my situation.

所以我有config.php文件

so i have config.php file

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

位于index.php附近的public_html文件夹中的.htaccess文件。

my .htaccess file in public_html folder near index.php.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

我的rewrite_module已打开(并且正在运行)和我的httpd。 conf AllowOverride设置为All

i have rewrite_module ON (and it's working) and my httpd.conf AllowOverride set to All

所以当我转到mydomain.com/controller/action时-我得到404
但当我转到mydomain.com/ index.php / controller / action-一切正常。.

so when i am going to mydomain.com/controller/action - I get 404 but when i go to mydomain.com/index.php/controller/action - everything is OK..

我尝试了很多.htaccess示例...等等。 p>

i have tried lots of .htaccess examples... and so on.. nothing helps..

推荐答案

.htaccess (应放置在应用程序文件夹之外)

.htaccess (This should be place outside application folder)

粘贴此

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




注意:有时 index.php 不会在Windows中删除。但是,如果将其上传到服务器,它将可以正常工作。在 XAMPP 中也会发生这种情况,但是如果我将其上传到主机(Linux),它也可以正常工作

Note : Sometime index.php will not remove in windows. But if you upload it to server it will work fine. This happen me too in XAMPP but if i upload it to host(Linux) it works fine

这篇关于从Wamp中的Codeigniter URL中删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆