php - Codeigniter - getting 404 Not Found error -


we have 2 hosting packages @ godaddy. our live website working fine using following .htaccess file. website accessible without using index.php in url.

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l]  

we used same htaccess file , same code on other hosting godaddy. wanted make production , development instances seperate. on other hosting same code , htaccess file, website shows 404 page not found error website works fine index.php in url.

we have same php version on both server. wants know issue?

i faced similar problem when move 100% working code dedicated debian server. after 3 hours of research, found out why htaccess file not working.you need allow overriding of htaccess in apache configuration.

here steps.

step 1:

add 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 file & change to

allowoverride 

for www folder

step 4:

restart apache (command)

sudo /etc/init.d/apache2 restart 

before make changes in apache2.conf file make sure make backup copy of file. if using debian server can avoid sudo command. believe know how connect server using ssh client software putty. comment below if method not work you.


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -