簡體   English   中英

錯誤301在Web服務器上永久移動

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM