Codeigniter issues with paths in localhost (XAMPP)

前端 未结 2 1652
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-15 00:56

The index page (aka homepage.php) in my code igniter install is working fine no matter what.

The problem lies with using subdirectories to store other pages, current

相关标签:
2条回答
  • 2021-01-15 01:15

    please create .htaccess file in project folder and write:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # Rewrite all other URLs to index.php/URL
    RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 
    
    </IfModule>
    <IfModule !mod_rewrite.c>
     ErrorDocument 404 index.php
    </IfModule>
    

    You don't need to define in base_url in config file:

    $config['base_url'] = ''; // blank it.
    
    0 讨论(0)
  • 2021-01-15 01:22

    Figured out what I was doing wrong:

    I needed to be accessing : http://localhost/VAw_CI/**index.php**/pages/aboutus which is really strange because my default CI page is set to $config['index_page'] = 'homepage';

    Hope this helps someone, sometime :)

    0 讨论(0)
提交回复
热议问题