codeigniter: Remove index.php not working

后端 未结 3 1542
囚心锁ツ
囚心锁ツ 2021-01-14 06:39

I am trying to remove index.php from url. But its not working!

Using ubuntu 12.04 ( LAMP).

CodeIgniter_2.1.2

.htaccess file



        
相关标签:
3条回答
  • 2021-01-14 07:30

    The project root-directory .htaccess file replace with below contains.

    RewriteEngine on 
    RewriteBase /your-project-directory-name/ 
    RewriteCond $1 !^(index.php|resources|robots.txt) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
    
    0 讨论(0)
  • 2021-01-14 07:39

    Got it.
    permit changes in the .htaccess file

    0 讨论(0)
  • 2021-01-14 07:44

    Htaccess:

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

    And in your applications/config/config.php

    $config['base_url'] = 'http://www.yourwebsite.com'; //url to your project
    $config['index_page'] = ''; //Needs to be empty
    
    0 讨论(0)
提交回复
热议问题