【问题标题】:removing index.php in hmvc删除 hmvc 中的 index.php
【发布时间】:2017-04-03 02:21:50
【问题描述】:

我想在 hmvc 代码点火器中删除 index.php,当我键入没有 index.php 的 url 时,它运行良好,但是当我处理到其他控制器时,url 在我的 codeigniter 文件夹之后自动显示 index.php。

例如我输入:

localhost/ci_hmvc/user/login 

当我处理到其他控制器时的结果是:

localhost/ci_hmvc/index.php/user/dashboard

还有我的 .htaccess

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

请任何人帮助我

【问题讨论】:

  • login.php 控制器上是否有重定向?

标签: codeigniter url codeigniter-hmvc


【解决方案1】:

您可以在配置文件夹中的config.php 中进行更改 你可以看到这条线

$config['index_page'] = 'index.php';

把这一行改成

$config['index_page'] = '';

希望对你有帮助

【讨论】:

  • 并检查你在 base_url 中的内容
【解决方案2】:

把这段代码放在.htaccess中,把htaccess文件放到文件夹的根目录下..

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-22
    • 2014-04-09
    • 1970-01-01
    • 2012-10-30
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多