[英]How to call controller in codeigniter from folder?
我有一個網站
Codeigniter實例保存在名為backend的文件夾中。
設置后端測試環境為。
因此,路徑將為:
publichtml /團隊/ ABC
現在嘗試登錄時出現404 not found錯誤 。
誰能幫我解決腳本中的問題:
<script>
function sendData() {
var username = $("#username").val();
var userpass = $("#userpass").val();
$.post('https://example.com/team/abc/index.php/login/authenticateUserWeb',{ 'username': username, 'userpass': userpass }, function( data ) {
alert(data);
if(data == 'success'){
window.location = "https://example.com/team/abc/index.php/companyadmin/folders";
}else if(data == 'successuser'){
window.location = "https://example.com/team/abc/index.php/companyuser";
}else if(data == 'expired'){
window.location = 'https://example.com/team/abc/index.php/companyadmin/selectPacakge';
}else{
$("#user").html(data);
//alert(data);
}
});
}
現在,當我嘗試登錄時在控制台日志中發現以下錯誤:
POST https://example.com/team/abc/index.php/login/authenticateUserWeb
301永久移動
jquery-1.10.2.js (line 6)
GET https://example.com/team/abc/login/authenticateUserWeb
找不到404
https://example.com/team/abc/login/authenticateUserWeb “
NetworkError:找不到404
如何在Codeigniter中使用Wordpress和其他添加兩個項目
假設下面的目錄結構
www/
.htaccess (wordpress htaccess)
index.php (wordpress index.php and files)
www/backend/
.htaccess (codeigniter htaccess)
index.php (codeigniter htaccess)
對於Wordpress的HTACCESS文件
//just add this line in wordpress htaccess
<Directory "backend/">
Allow from all
</Directory>
對於Codeigniter HTACCESS文件
//add this lines in your codeigniter htaccess
RewriteEngine on
RewriteBase /backend/
...
RewriteRule ^(.*)$ /backend/index.php?/$1 [QSA,L]
這種類型的工作對我來說都是無休止的...
我還不能發表評論,但對我來說,URL中似乎缺少您的“ index.php”:
https://example.com/team/abc/index.php/login/authenticateUserWeb
可以在以下時間找到:
https://example.com/team/abc/login/authenticateUserWeb
不能(返回404)。
這些網址之間的區別在於,最后一個沒有/index.php/。
您可以檢查一些步驟:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.