CodeIgniter从网址中删除index.php

CS学习101

我知道这个问题已经被问过很多次了。但是,我仍然无法摆脱index.php网址。这阻止了我直接访问我的控制器。

我目前正在使用CodeIgniter 2.2.2
以下是我的.htaccess文件:

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

应用程序/配置:

//  Find the below code

$config['uri_protocol'] = "AUTO"

//  Replace it as

$config['uri_protocol'] = "REQUEST_URI" 

任何的想法?在此先感谢您的时间。

CS学习101

终于解决了我的问题。我想与大家分享我的答案。我当前正在使用Mac,将.htaccess文件重命名为htaccess.txt,并在htaccess中包含以下代码:RewriteEngine On

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
#RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]


</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

ErrorDocument 404 /index.php

然后通过执行以下操作确保Apache正在读取htaccess.txt文件:

  1. 在您的httpd.conf上取消注释以下行

  2. 往里走多余/的httpd-default.conf文件并更改这一行代码:AccessFileName .htaccessAccessFileName htaccess.txt

  3. 重新启动Apache服务器

  4. 在您的配置中,请确保将“ base_url”留空(索引页仍然可以存在,没关系)。并且$ config ['uri_protocol'] ='REQUEST_URI';

希望这可以帮助其他人!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

从CodeIgniter 3中的网址中删除index.php

来自分类Dev

Codeigniter从浏览器网址中删除index.php

来自分类Dev

如何使用https://www.com删除codeigniter中的index.php。在网址中?

来自分类Dev

从网址代码中删除index.php在Godaddy Plesk托管的codeigniter中不起作用?

来自分类Dev

从 CodeIgniter URL 中删除 index.php

来自分类Dev

从网址中删除.php

来自分类Dev

从网址中删除.php

来自分类Dev

Yii2从网址中删除index.php

来自分类Dev

.htaccess从网址中删除index.php并隐藏参数键

来自分类Dev

如何从网址中删除index.php / html

来自分类Dev

nginx重定向循环,从网址中删除index.php

来自分类Dev

使用.htaccess从网址中删除index.php

来自分类Dev

从网址中删除/重定向index.php以防止重复的网址

来自分类Dev

从网址中删除/重定向public / index.php以防止重复的网址

来自分类Dev

从网址中删除/重定向index.php以防止重复的网址

来自分类Dev

使用CakePHP漂亮网址时,从网址中删除index.php

来自分类Dev

在Windows Azure中从Codeigniter中的URL删除index.php

来自分类Dev

从Codeigniter中的URL中删除index.php

来自分类Dev

在Windows中从CodeIgniter URL中删除index.php

来自分类Dev

再次从网址中删除php(!)

来自分类Dev

再次从网址中删除php(!)

来自分类Dev

删除index.php codeigniter

来自分类Dev

我无法从CodeIgniter URL中删除index.php

来自分类Dev

Nginx CodeIgniter删除URL中的index.php

来自分类Dev

删除index.php并在htaccess Codeigniter中添加www

来自分类Dev

从Codeigniter URL中删除index.php无法正常工作

来自分类Dev

Nginx CodeIgniter删除URL中的index.php

来自分类Dev

Codeigniter从Wamp中的URL删除index.php

来自分类Dev

从子域Codeigniter 3中删除index.php

Related 相关文章

热门标签

归档