0

I am trying to remove index.php in codeigniter.my codegiter project is inside public_html/programemis/lasoona/.I have my .htacess file with the following code.

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

but its not working .any one please help.

4
  • 1
    That looks okay to me, are you getting a 404? Do you have base_url defined? What about $config['index_page'], is it empty? Commented Feb 3, 2016 at 20:43
  • Good point @kisaragi .... Adding one more thing remove QSA Commented Feb 3, 2016 at 20:46
  • $config['index_page'] is empty but still not working Commented Feb 3, 2016 at 20:46
  • index.php/$1 would produce index.php/foo/bar, which isn't going to be a valid url, unless you have path_info enabled. perhaps you want index.php?$1? Commented Feb 3, 2016 at 20:51

3 Answers 3

0

Try this :

RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /programemis/lasoona/index.php?/$1 [L,QSA]
Sign up to request clarification or add additional context in comments.

1 Comment

dear @aeonsleo , try this one too but sill not working.
0

There have been a lot of solutions posted online for this. Here's from stackoverflow itself:

Codeigniter remove index.php - htaccess localhost

If it won't work, here's another (this works for me) based from:

https://docs.expressionengine.com/latest/urls/remove_index.php.html

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule .* index.php/$0 [PT,L]
</IfModule>

Just be mindful of the location of .htaccess.

enter image description here

Comments

0

I use it and working try it. If dont work remove programemis folder from RewriteBase. If you get same problem I recommented create a sub-domain.

RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

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.