简体   繁体   中英

Htaccess not working in Codeigniter

I am using tank auth in my project. In my localhost it is working fine. But when I uploaded the project to the server, I am getting the error as

No input file specified.

I know that it is because of htaccess. My url is like http://example.org/project/test/tankauth/ . When I give this url, it will redirect to http://example.org/project/test/tankauth/index.php/auth/login with the error. However, if I try with the url like http://example.org/project/test/tankauth/index.php?/auth/login , it will work fine.

My htaccess file is as shown below:

RewriteEngine on
RewriteBase /tankauth/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

I am not good in htaccess.

I assume your using apache on this one, I'm also assuming that you haven't made any changes in your apache config /etc/apache2/, and finally I'm assuming that you have an access to your server, then if that's the case, you might want to check http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

in your /etc/apache2/sites-available/default there you'll find

<Directory /path/to/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None <---change None to FileInfo or All
Order allow, deny
allow from all
</Directory>

then reset your apache -> service apache2 restart or sudo service apache2 restart

heads up using AllowOverride All may flag some serious vulnerability issues, if this is a production server I suggest you to not use it.

hope it helps, cheers!

try this (change last line)

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

and in application/config/config.php

$config['uri_protocol']         ="PATH_INFO";

It's Work.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /tankauth/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ index.php/$1[L]
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM