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.

3
  • RewriteRule ^(.*)$ /index.php/$1 [L] Commented Nov 14, 2013 at 7:03
  • @Hussaintamboli in godaddy urls are like.../index.php?.. Commented Nov 14, 2013 at 7: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)` Commented Nov 14, 2013 at 7:30

5 Answers 5

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> 
Sign up to request clarification or add additional context in comments.

3 Comments

But is there any need of +FollowSymLinks in this answer? for @chirag
@hussain tamboli : no
@chirag Okay. Don't forget to use AllowOverride All in Directory directive of /etc/apache2/sites-enabled/<your core config file>. This way .htaccess is enabled
0

Try

$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";

3 Comments

do you have mod_rewrite enabled?
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L]
try that for your htaccess
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';

Comments

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

Comments

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.