从url中删除index.php文件 - Codeigniter

时间:2015-10-27 10:58:29

标签: php .htaccess codeigniter

这是我的链接:

http://vitrinsaz1.ir/Mobile/Vitrinsaz/Pannel/index.php/welcome

我想从网址中删除index.php。

我的.htaccess文件:

  

/潘内尔

     

的.htaccess

<IfModule mod_rewrite.c>


RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.vitrinsaz1.ir
RewriteRule ^.*$ http://www.vitrinsaz1.ir%{REQUEST_URI} [R=301,L]

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA] 

</IfModule>
$config['index_page'] = '';

$config['base_url'] = 'http://vitrinsaz1.ir/Mobile/Vitrinsaz/Pannel/';

3 个答案:

答案 0 :(得分:0)

试试这个

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

了解更多信息http://w3code.in/2015/09/how-to-remove-index-php-file-from-codeigniter-url/

答案 1 :(得分:0)

在最后一条规则index: { build: { dir: '<%= build_dir %>', src: [ '<%= build_dir %>/app/app.js', '<%= build_dir %>/app/**/*module.js', '<%= build_dir %>/app/**/*constants.js', '<%= build_dir %>/app/**/*provider.js', '<%= build_dir %>/app/**/*enum.js', '<%= build_dir %>/app/**/*model.js', '<%= build_dir %>/app/**/*config.js', '<%= build_dir %>/app/**/*filter.js', '<%= build_dir %>/app/**/*directive.js', '<%= build_dir %>/app/**/*decorator.js', '<%= build_dir %>/app/**/*interceptor.js', '<%= build_dir %>/app/**/*service.js', '<%= build_dir %>/app/**/*workflow.js', '<%= build_dir %>/app/**/*repository.js', '<%= build_dir %>/app/**/*resolver.js', '<%= build_dir %>/app/**/*controller.js' ] } } 之后添加?,以便您的.htaccess就像

index.php

答案 2 :(得分:0)

您可以尝试此设置;

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

和.htaccess;

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

如果不起作用请尝试此链接;

http://www.formget.com/codeigniter-htaccess-remove-index-php/