1
votes

having problem in removing index.php from my URLs in Codeigniter.

my live url : "http://ec2-174-129-44-226.compute-1.amazonaws.com" problem in live server

also prblem with local

I have tried using below code.

RewriteEngine on

RewriteCond $1 !^(index.php|resources|robots.txt)

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d`

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

But it will fire error in local wamp server

"Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log."

Please.....help..me...Thanks....

2
And your question is? And a little question back: Why did you think in the first place such a piece of code would have done what you're looking for? (please also check the formatting of your question=)hakre
possible duplicate of Remove index.php in codeigniter 2.1.0Bora
have you tried adding "RewriteBase /your_project_folder/" after RewriteEngine on ?lollo

2 Answers

1
votes

Try It.

Open config.php and do following replaces

$config['index_page'] = "index.php"
to
$config['index_page'] = ""

In some cases the default setting for uri_protocol does not work properly. Just replace $config['uri_protocol'] ="AUTO" by $config['uri_protocol'] = "REQUEST_URI"

HTACCESS

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

Open config.php and do following replaces

$config['index_page'] = "index.php" 

Replace With

$config['index_page'] = ""

And

$config['uri_protocol'] = "AUTO" 

Replace With

$config['uri_protocol'] = "REQUEST_URI"

HTACCESS

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