[英]Error 301Moved Permanently on web server
我在本地主機上成功運行了代碼。 但服務器上的相同代碼我得到永久刪除的錯誤301。 我使用發布請求。 我的代碼如下。
$(function(){
$("#search_text").keyup(function(e){
var sVal = $(this).val();
$("#search").removeAttr('disabled');
$.post('http://localhost/website/index.php/search/ajaxResults',{Search:sVal},function(data){
//my code here
});
});
});
它成功完成了。
但在網絡服務器上也有以下代碼:
$(function(){
$("#search_text").keyup(function(e){
var sVal = $(this).val();
$("#search").removeAttr('disabled');
$.post('http://schoolanduniversity.com/index.php/search/ajaxResults',{Search:sVal},function(data){
//my code here
});
});
});
我收到錯誤301
那就是因為這個網址:
http://schoolanduniversity.com/index.php/search/ajaxResults
重定向到該URL:
http://www.schoolanduniversity.com/index.php/search/ajaxResults
schoolanduniversity.com
的DNS配置就是重定向到www.schoolanduniversity.com
。
如果您更改網址以將www
放在前面,則應該可以
error code 301
不是錯誤,它更像是警告,例如
您正在嘗試訪問thispage.com,但是服務器已移至thatpage.com,請下次使用thatpage.com。
有關更多信息,請在此處檢查: HTTP / 1.1:狀態代碼定義#錯誤代碼301
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.