简体   繁体   English

htaccess在Codeigniter中不起作用

[英]Htaccess not working in Codeigniter

I am using tank auth in my project. 我在我的项目中使用tank auth。 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. 我知道这是因为htaccess。 My url is like http://example.org/project/test/tankauth/ . 我的网址就像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. 当我提供此网址时,它将重定向到http://example.org/project/test/tankauth/index.php/auth/login并显示错误。 However, if I try with the url like http://example.org/project/test/tankauth/index.php?/auth/login , it will work fine. 但是,如果我尝试使用类似http://example.org/project/test/tankauth/index.php?/auth/login的网址,它将可以正常工作。

My htaccess file is as shown below: 我的htaccess文件如下所示:

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

I am not good in htaccess. 我的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 我假设您在此服务器上使用apache,我还假设您尚未对apache config / etc / apache2 /进行任何更改,最后我假设您可以访问服务器,那么如果在这种情况下,您可能要检查http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

in your /etc/apache2/sites-available/default there you'll find 在您的/ etc / apache2 / sites-available / default中,您会找到

<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 然后重置您的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. 抬起头使用AllowOverride All可以标记一些严重的漏洞问题,如果这是一个生产服务器,我建议你不要使用它。

hope it helps, cheers! 希望能有所帮助,加油!

try this (change last line) 试试这个(更改最后一行)

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

and in application/config/config.php 并在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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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