0

I had recently updated my ubuntu from 14.04 to 16.04. I am working with codeigniter.

Before update, all project was working fine but now no one project is working with .htaccess . I'm using htaccess to hide index.php from url.

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

This is my htaccess file in the root folder of project.

chigs
  • 178
  • 2
  • 12
  • 1
    Please define *not working* – Capsule Jun 27 '17 at 05:23
  • defined @Capsule – chigs Jun 27 '17 at 05:24
  • is mod_rewrite enabled? – M. Eriksson Jun 27 '17 at 05:27
  • from where. can you please explain ? @MagnusEriksson – chigs Jun 27 '17 at 05:28
  • Defined where? I can't see any update in the question – Capsule Jun 27 '17 at 05:29
  • 1
    mod_rewrite is the Apache module that actually handles the rewrite. On your server (through ssh), try: `sudo a2enmod rewrite && sudo apache2ctl restart` and try your site again. – M. Eriksson Jun 27 '17 at 05:31
  • 1
    You may need to enable the rewrite module and restart the server. See this answer: https://stackoverflow.com/a/14807463 (begin at step 3) – Benson Jun 27 '17 at 05:33
  • Thanks @Benson. It works. – chigs Jun 27 '17 at 05:45
  • Possible duplicate of [CodeIgniter htaccess and URL rewrite issues](https://stackoverflow.com/questions/14783666/codeigniter-htaccess-and-url-rewrite-issues) – Abdulla Nilam Jun 27 '17 at 06:18
  • try this answer its works on my ubantu VPS [CLICK HERE](https://stackoverflow.com/questions/42924542/error-no-input-file-specified-codeigniter-on-hostinger-in/42925228#42925228) – Gopal Bhuva Jun 27 '17 at 07:19
  • You're welcome @chigs; I originally posted the comment as an answer but I deleted the answer and reposted as a comment after @Narayan downvoted and flagged my answer was a more of comment, since it was more of a "try and see if this works" kind of answer. And you've marked it as an answer; and now I'm mystified as to how the world should work. Ha! – Benson Jun 27 '17 at 15:33

2 Answers2

0

This is the answer, Givan by Benson in the comments.

You may need to enable the rewrite module and restart the server. See this answer: https://stackoverflow.com/a/14807463

chigs
  • 178
  • 2
  • 12
-3

You may miss ? after index.php.

Change your

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

To

RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Yadhu Babu
  • 1,503
  • 2
  • 13
  • 25