4

My codeigniter is installed in admin_new folder on hostinger and path of installed codeigniter is public_html/vishwa/admin_new/ and i am trying to remove index.php from url.

I have changed my .htaccess file as below.

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

I have checked forums and it says mode_rewrite is enabled as default on hostinger. but it is showing error like No input file specified.

I have also changed config settings in config.php as below:

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

but still it is showing same error. Why this type of error has been shown and how can i solve it.

Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
Dhara Vihol
  • 602
  • 5
  • 26
  • Have you set base_config to `http://www.yourdomain.tld/vishwa/admin_new/`? Also change this in `.htaccess` file `RewriteRule ^(.*)$ index.php?/$1 [QSA,L]` (note the question mark). – Tpojka Sep 12 '16 at 11:19
  • great. It removed the error. but when i got to url http://gurukrupa.tk/vishwa/admin_new/users it shows the http://gurukrupa.tk/vishwa/admin_new/users url in address baar. and other thing is it is not loading the css also. – Dhara Vihol Sep 12 '16 at 11:35
  • Ok. When i removed '?' after admin_new it works fine. – Dhara Vihol Sep 12 '16 at 11:38
  • Probably you are using relative paths and that way it depends on uri segments count. For css you should use something like ``. For JS files and images too. – Tpojka Sep 12 '16 at 11:50
  • got it. Thanks for your help. – Dhara Vihol Sep 12 '16 at 12:06
  • Enjoy your code. #SOreadytohelp – Tpojka Sep 12 '16 at 12:34

1 Answers1

3

try this

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
Guri
  • 83
  • 8