Codeigniter - getting 404 Not Found error

前端 未结 9 1778
慢半拍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

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

    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.

提交回复
热议问题