2

I am making application in codeigniter and now uploading to GoDaddy server but getting 404 error.

My code is like this

$config['index_page'] = "index.php?";
$config['uri_protocol'] = "QUERY_STRING";

.htaccess file is

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

I am getting value like

http://yourdomain.com/index.php?controller/action/etc

But i need

http://yourdomain.com/controller/action/etc

Please help.

Raptor
  • 53,206
  • 45
  • 230
  • 366
chirag
  • 105
  • 2
  • 3
  • 10
  • `RewriteRule ^(.*)$ /index.php/$1 [L]` – Hussain Nov 14 '13 at 07:03
  • @Hussaintamboli in godaddy urls are like.../index.php?.. – chirag Nov 14 '13 at 07:16
  • I don't know about godaddy urls but To pass everything after `http://yourdomain.com` in CI do the above thing. If you want to add some exceptions for say `images` i.e. you don't want `http://yourdomain.com/images/image.png` to follow above rule, put this just above it - ` RewriteCond $1 !^(index\.php|images)` – Hussain Nov 14 '13 at 07:30

5 Answers5

0

try this

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule> 
vijaykumar
  • 4,658
  • 6
  • 37
  • 54
0

Try

$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
Ela Buwa
  • 1,652
  • 3
  • 22
  • 43
0

Try this... it should work.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sgu_portal
RewriteCond $1 ^(application|system|private|logs)
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]
RewriteCond $1 ^(index\.php|css|js|images|img|less|player-skin|robots\.txt|opensearch\.xml|favicon\.ico|assets|forums)

input your folder CSS,js,images or else. If not your css not working.

RewriteRule ^(.*)$ - [PT,L]
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>

and in CI Config

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
Prabu Karana
  • 302
  • 1
  • 4
  • 15
0

refer this answer

https://stackoverflow.com/a/16558169/1182195

make sure that your server configuration is set to

1 . Enabled mod rewrite

2 . Allow overriding htaccess in your apache

Community
  • 1
  • 1
Dino Babu
  • 5,814
  • 3
  • 24
  • 33
0

Thank you all for answer Thank you so much but correct answer is like this code of htaccess file is like this

Options -Indexes
Options +FollowSymLinks
Options -MultiViews
DirectoryIndex index.php
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [NC,L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
  ErrorDocument 404 index.php
</IfModule>
chirag
  • 105
  • 2
  • 3
  • 10