Codeigniter - getting 404 Not Found error

前端 未结 9 1762
慢半拍i
慢半拍i 2021-02-20 02:26

We have two hosting packages at godaddy. Our live website is working fine using following .htaccess file. Website is accessible without using index.php in url.

R         


        
相关标签:
9条回答
  • 2021-02-20 02:53

    I also faced the similar problem when I move my 100% working code to dedicated Debian server. After 3 hours of research, i found out why htaccess file is not working.You need to allow overriding of htaccess in Apache Configuration.

    Here are the steps.

    Step 1:

    Add this in htaccess file

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

    Step 2:

    Remove index.php in codeigniter config

    $config['index_page'] = '';
    

    Step 3:

    Allow overriding htaccess in Apache Configuration (Command)

    sudo nano /etc/apache2/apache2.conf
    

    and edit the file & change to

    AllowOverride All
    

    for www folder

    Step 4:

    Restart Apache (Command)

    sudo /etc/init.d/apache2 restart
    

    Before you make any changes in apache2.conf file make sure to make a backup copy of that file. If you are using Debian server you can avoid sudo command. I believe you know how to connect to your server using ssh client software like putty. Comment below if this method does not work for you.

    0 讨论(0)
  • 2021-02-20 02:56

    in index.php you echo "test" and run .then you can check whether it is called or not. in config file enable error log . Make your /application/logs folder writable. In /application/config/config.php set. $config['log_threshold'] = 4;

    check the log /application/logs folder

    0 讨论(0)
  • 2021-02-20 03:01

    You can use this. This works for me in godaddy hosting.

    RewriteEngine On 
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) index.php?/$1
    
    0 讨论(0)
提交回复
热议问题