-1

I create CodeIgniter project on my local machine (Running perfectly), then I uploaded to a server with its database but I am facing the problem of not found an error while opening admin panel.

I changed config file(for base URL), database.php(for database connection). but I don't know what to change in the .htaccess file, I took a default CodeIgniter .htaccess file but it is showing not found error. htaccess file :

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /crescent_test/ad_crescent/
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
 </IfModule>
 <IfModule !mod_rewrite.c>
   ErrorDocument 404 /index.php
 </IfModule>
Coderfe
  • 1
  • 4

2 Answers2

0

Try this updated code.

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

if this does not work then visit below link:

Page isn't working and returns HTTP error 500 in CodeIgniter

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
  • Thanks but it is not working, giving error like "This site can’t be reached" – Coderfe Mar 05 '18 at 10:42
  • Did you read this https://stackoverflow.com/questions/42456310/page-isnt-working-and-returns-http-error-500-in-codeigniter – Gufran Hasan Mar 05 '18 at 10:43
  • Yes, but i am not having subdomain problem – Coderfe Mar 05 '18 at 10:46
  • Okay, I am sure this will work for you. https://stackoverflow.com/questions/14783666/codeigniter-htaccess-and-url-rewrite-issues – Gufran Hasan Mar 05 '18 at 10:46
  • I follow that link and edit my htaccess file like this : RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.spacegm\.com RewriteRule ^(.*)$http://spacegm.com/crescent_test/%1/$1[L,NC,QSA] now it is giving 404 not found error – Coderfe Mar 05 '18 at 10:49
0

you can try this:

add htaccess file YOUR_ADMIN_FLODER root

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /YOUR_ADMIN_FLODER_NAME/
    Options -Indexes

    RewriteCond %{REQUEST_URI} ^system.*

    RewriteRule ^(.*)$ /YOUR_ADMIN_FLODER_NAME/index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*

    RewriteRule ^(.*)$ /YOUR_ADMIN_FLODER_NAME/index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ /YOUR_ADMIN_FLODER_NAME/index.php?/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /YOUR_ADMIN_FLODER_NAME/index.php
</IfModule>