1

Can someone tell me why this code would work on my local server but not on godaddy server?

I get the following error on godaddy...

I have creating one codeigniter project and host on godaddy server but .htaccess file does not working

my problem is "https://www.tripbrip.com/index.php/home/app_view" this same url come in my url side but i want to remove index.php in this link

my directory structure is this:

Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ index.php/?$1 [NC,L]

my config file:
$config['base_url'] = "https://".$_SERVER['HTTP_HOST'].'/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

This file run in my localhost but not working on server.

I have use many code but still problem remain same .

If I browse to http://example.com/bootstrap.php I get a 404 resource not available at /

Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
Shivraj
  • 31
  • 5
  • Try looking at solutions posted here: http://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url – Just_Do_It Dec 09 '16 at 13:29

2 Answers2

0

The following setting works fine for me.

RewriteEngine on -MultiViews
Options All -Indexes

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

in application => config => config.php

$config['index_page'] = ''; // should be blank

instead of

$config['index_page'] = 'index.php';
Muhammad Hassaan
  • 7,296
  • 6
  • 30
  • 50
  • i really thanks for your answer. i used this code as per your suggestion but problem still remain same. so any other way to solve this problem please suggest me – Shivraj Dec 09 '16 at 08:33
  • @ShivrajHipparge I have updated my answer again. Hope it will fix the issue. – Muhammad Hassaan Dec 11 '16 at 20:01
0

Maybe u can try put this on your .htaccess

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

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

</IfModule>

And for your config file. maybe u can just empty it.

$config['base_url'] = '';

If still error, you can try this

$config['base_url']  =  "http://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])).'/';
M. AmirQ
  • 61
  • 5