简体   繁体   English

HTACCESS在localhost中有效,但在远程主机中无效

[英]HTACCESS works in localhost but not in remote host

I know this has been asking many times, but none of the solutions I tried worked. 我知道这已经问了很多遍了,但是我尝试过的所有解决方案都没有用。 All this works fine in my localhost. 所有这些都可以在我的本地主机上正常工作。 But after I uploaded on a remote host all controller links need the "index.php/" pre-appended to them in order for them to work. 但是在我将文件上传到远程主机后,所有控制器链接都需要预先添加到它们的“ index.php /”才能正常工作。

htaccsess: htaccsess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

the .htaccess file is in the CI root folder. .htaccess文件位于CI根文件夹中。

my config: 我的配置:

$config['base_url'] = "http://".$_SERVER['SERVER_NAME']."/";
$config['index_page'] = "";
$config['uri_protocol'] = 'AUTO';

I already tried changing the uri_protocol to "REQUEST_URI" and "ORIG_PATH_INFO", still no joy. 我已经尝试过将uri_protocol更改为“ REQUEST_URI”和“ ORIG_PATH_INFO”,但仍然没有任何乐趣。 I heard that there's a step involving setting up the httpd.conf file and changing the "AllowOverride " to "ALL". 我听说有一个步骤涉及设置httpd.conf文件并将“ AllowOverride”更改为“ ALL”。 But I guess I have no access to the httpd.conf in the remote server(shared). 但是我想我无法访问远程服务器(共享)中的httpd.conf。

Any help will be much appreciated. 任何帮助都感激不尽。

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

#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .* index.php/$0 [PT,L]  

Works for me on local as well as on remote .. 在本地和远程为我工作。

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

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