How to Fix ERR_TOO_MANY_REDIRECTS in WordPress

文章推薦指數: 80 %
投票人數:10人

The ERR_TOO_MANY_REDIRECTS error happens when a browser can't connect to the correct server of your website. The browser goes back and forth ... WordPress VPS Joomla! Drupal Email Glossary VideoTutorials Webinars search Copylink Copied! WordPress Errors Nov09,2021 TomasA. 8minRead HowtoFixERR_TOO_MANY_REDIRECTSinWordPress Copylink Copied! IfyourunaWordPresswebsite,youmayencountertheERR_TOO_MANY_REDIRECTSerroratsomepoint.Thiscommonlyhappenswhenyourwebsiteisstuckinaninfiniteredirectloop,preventingyourbrowserfromreachingouttothecorrectwebserverandloadingthedesiredwebpagecontent. ThisarticlewillshowseveralwaystosolvetheERR_TOO_MANY_REDIRECTSerror.Youwillalsolearnwhatcausesitandhowitlooksondifferentwebbrowsers. WhatIsERR_TOO_MANY_REDIRECTS?HowDoesERR_TOO_MANY_REDIRECTSLookLikeOnDifferentBrowsersGoogleChromeMicrosoftEdgeMozillaFirefoxSafariOperaHowtoFixERR_TOO_MANY_REDIRECTS1.DeletingBrowserData2.CheckingtheURLSettings3.DeletingWordPressCache4.DisablingCorruptedPlugins5.Disablingthe.htaccessFile6.TurnOfftheContentDeliveryNetwork(CDN)Temporarily  WhatIsERR_TOO_MANY_REDIRECTS? TheERR_TOO_MANY_REDIRECTSerrorhappenswhenabrowsercan’tconnecttothecorrectserverofyourwebsite.ThebrowsergoesbackandforththroughmultipleURLsandserverstryingtolocateyourWordPresswebsite.Asaresult,thewebsitesendsusersintoaredirectionloopthatwillnevercometoanend. Thisredirectlooperroroccursduetoafewreasons: MisconfiguredWordPresswebsiteaddress‒happenswhenyourwebsitepointsatthewrongdomainorhasatypointhedomainnameorthewwwprefix. Corruptedbrowsercookiesandoutdatedcache‒themostcommonculpritandtheeasiesttofix.FaultyWordPressplugin‒causedbyacorrupted,outdated,ormisconfiguredplugin.IncorrectHTTPSsettings‒occurswhenyoumisconfiguretheSSLcertificateorHTTPSredirectrules.Misconfiguredserversettings‒happenswhenthe.htaccessfilehasafaultyvariable. Issueswiththird-partyservices‒forexample,misconfiguredcontentdeliverynetwork(CDN). Fortunately,thereareseveralmethodstofixtheERR_TOO_MANY_REDIRECTSerror.Wewillcovereachonelaterinthearticle. HowDoesERR_TOO_MANY_REDIRECTSLookLikeOnDifferentBrowsers EachwebbrowserhasitswayofwarninguserswhentheyvisitawebsitewiththeERR_TOO_MANY_REDIRECTSerror.Takealookatwhatseveralpopularbrowsersshowwhenyouexperiencethisproblem. GoogleChrome GoogleChromewillshowtheredirectlooperroras“Thispageisn’tworking.example.comredirectedyoutoomanytimes.”Thebrowserwillrecommendasolutiontosolveit,followedbytheERR_TOO_MANY_REDIRECTSerrormessageconfirmingtheproblem. MicrosoftEdge MicrosoftEdgewillshowthiserroras“Thispageisn’tworkingrightnow.example.comredirectedyoutoomanytimes”,followedbytheERR_TOO_MANY_REDIRECTSerrormessage. MozillaFirefox MozillaFirefox’serrormessagesays,“Thepageisn’tredirectingproperly.Firefoxhasdetectedthattheserverisredirectingtherequestforthisaddressinawaythatwillnevercomplete.” Safari Safariwillshowtheerroras“Safarican’topenthepage‒Toomanyredirectsoccurredtryingtoopen“example.com.”Thismightoccurifyouopenapagethatisredirectedtoopenanotherpagewhichisthenredirectedtoopentheoriginalpage.” Opera Opera’serrormessagelookssimilartoChrome’s,whichis“Thispageisn’tworking.example.comredirectedyoutoomanytimes”,followedbytheERR_TOO_MANY_REDIRECTSerrorlabel. HowtoFixERR_TOO_MANY_REDIRECTS ThereareafewwaystofixtheERR_TOO_MANY_REDIRECTSerror.Werecommendtryingeachofthemindividuallytofindthecauseoftheredirectloopproblem,butmakesuretotrackyourstepssothatyoucanreversethechangesifneeded. Thatsaid,herearethesixtroubleshootingstepstofollowincaseoftheERR_TOO_MANY_REDIRECTSerrorinWordPress. 1.DeletingBrowserData Browserdatasometimesstorescorruptedcookiesandoutdatedcache,causingtheERR_TOO_MANY_REDIRECTSerror.So,beforemakingchangestoyourWordPresssite,it’swisetocheckifit’sjustyourbrowsercausingtheerrorbydeletingitsdatahistory. Herearethestepsyoushouldfollowtodeletethebrowser’scacheandcookies: OnChrome,clickthethreesmalldotsonthebrowser’supper-rightmenuandselectSettings.ScrolldownandclickonAdvanced->ClearBrowsingData.ChecktheCookiesandothersitedataandCachedimagesandfilesboxes,clickCleardata. OnMozilla,headtotheupper-rightmenubutton,selectOptions.ChoosePrivacyandSecurity,selectClearDataunderCookiesandSiteData.Makesuretocheckalltheboxes,andthenclickClear. OnSafari,navigatetoSettings->Preferences.UnderPrivacy,selectRemoveAllWebsiteData->RemoveNow.Here,youcansetyourcookieandcachepreferencesaswell. OnMicrosoftEdge,navigatetoSettings->Cookiesandsitepermissions.SelectManageanddeletecookiesandsitedata->Seeallcookiesandsitedata.ClickontheRemoveallbutton,andthenchooseClear. 2.CheckingtheURLSettings Ifclearingyourbrowsingdatadoesn’tfixtheproblem,checkifyourWordPressURLsettingshavethecorrectconfiguration. TheredirectlooperrorusuallyoccurswhenwebmastersaccidentallymaketheirWordPresssitepointatthewrongdomainwhenmigratinghostsorchangingdomainnames.  YoucandosothroughtheWordPressadmindashboardormanually. CheckingandChangingURLSettingsManually WhenyourwebsiteisexperiencingtheERR_TOO_MANY_REDIRECTSerror,youmightnotbeabletoaccessyourWordPressadminarea.Inthatcase,changetheURLsettingsbyeditingthewp-config.phpfilethroughyourFileManageroranFTPclientlikeFileZilla. WewillshowyouhowtoeditthefileviaHostinger’sFileManager. LogintothehPanelandheadtoFileManagerunderFiles. Inthepublic_htmldirectory,findyourwp-config.phpfileandright-clicktoEdit. Addthefollowinglinestothefile.Inthiscase,http://example.comisyourdomainname:define('WP_HOME','http://example.com');define('WP_SITEURL','http://example.com'); Aftersavingthechanges,visityourWordPresssitetocheckwhethertheURLchangefixedtheERR_TOO_MANY_REDIRECTSerror. EditURLSettingsviaDatabase Alternatively,youcanedittheURLsettingsviayourWordPressdatabase.ThefollowingtutorialwillshowyouhowtodoitusingphpMyAdmin. FindyourWordPressdatabasenameviathewp-config.phpfile.LogintothehPanelandnavigatetophpMyAdminunderDatabases.SelecttheEnterphpMyAdminbuttonnexttothedatabaseconnectedtoyourWordPresssite. AccesstheSQLtabwithinthephpMyAdminarea. EnterthefollowingSQLquery,makingsuretoreplaceoldurl.comwiththecurrentWordPressaddressandnewurl.comwiththenewsiteaddress:UPDATEwp_optionsSEToption_value=replace(option_value,'oldurl.com','newurl.com')WHEREoption_name='home'ORoption_name='siteurl';UPDATEwp_postsSETguid=replace(guid,'oldurl.com','newurl.com');UPDATEwp_postsSETpost_content=replace(post_content,'oldurl.com','newurl.com');UPDATEwp_postmetaSETmeta_value=replace(meta_value,'oldurl.com','newurl.com'); ClickGotoexecutethequery.Openthewp-optionstableandchecktheoption_valueofsiteurlandhometoseewhethertheupdateprocesswassuccessful. Ifyouneedmoreinformation,makesuretocheckourtutorialabouthowtochangeWordPressURLsinMySQLdatabaseusingphpMyAdmin. Ifyourwebsitefileisinthedefaultrootfolder(/public_html/),youcanusethedefault(http://example.com/)URL.Ifit’sinasubfolderlike(/wp/),thenreplacetheURLwithsomethinglike(http://example.com/wp). ChangingURLSettingsviaAdministratorDashboard AnothersolutiontochangetheURLsettingsisthroughyourWordPressdashboard.Followthestepsbelowifyoucanlogintotheadmindashboard. NavigatetoSettingsfromyourWordPressadmindashboard.OntheGeneralSettingspage,checkyourWordPressAddress(URL)andSiteAddress(URL). MakesurebothURLsareconfiguredcorrectly.Ifyoueditthem,don’tforgettosaveanychangesmade.   3.DeletingWordPressCache Yourbrowserisn’ttheonlyplacepronetostoringcorruptedcache.Insomecases,cachestoredonyourWordPresssitemaycausetheERR_TOO_MANY_REDIRECTSerror.Toclearyourcache,pickoneofthesetwooptions. 1.UsingtheWPFastestCachePlugin WPFastestCacheisafreemiumWordPresscacheplugin.Thecachingfeatureincludedinthefreeversionismorethanenoughtohelpyoudeletethecachestoredonthewebsite.  Here’showtoclearthewebsitecacheusingtheWPFastestCacheplugin: LogintoyourWordPressdashboard.HeadtoPlugins->AddNew.FindWPFastestCacheusingthesearchbarandclickInstallNow->Activatetosetuptheplugin.RefertoourguideformoreinformationonhowtoinstallWordPressplugins.LookfortheWPFastestCacheoptionunderSettings.OntheDeleteCachetab,choosewhichoptionbestsuitsyourneeds. Iftheprocessissuccessful,aconfirmationmessagewillappearatthetopofthepage. 2.UsingtheWPRocketPlugin WPRocketisapremiumWordPresscacheplugin.Besidesbeingcompatiblewithpopularthemes,plugins,andhostingproviders,WPRocketalsocomeswithfeaturesthatadherebestpracticesinwebperformance.Itspricesrangefrom$49/yearto$249/year. ToclearthewebsitecacheusingtheWPRocketplugin,followthesesteps: Afterpurchasingtheplugin’slicense,downloadittoyourcomputer.UploadthepluginfiletoWordPressandinstallitmanually.AccesstheWPRocketdashboard.SelectClearCacheunderQuickActionstoremoveallcachedfiles. 4.DisablingCorruptedPlugins AnotherproblemthatmightcausetheERR_TOO_MANY_REDIRECTSerrormessageisacorruptedoroutdatedplugin.Insomecases,certainWordPresspluginsthatimplementredirectsmightconflictwithyourserver’sredirects. Tocheckwhetherthat’sthesourceoftheproblem,disableallofyourpluginsbymanuallyeditingthefolder. Youcandosothroughyourhostingprovider’sFileManageroranFTPclient.Here,we’llbeusingthelatter. First,configureyourFileZillaclient.Ifyouneedmoreinformationonhowtodoit,weprovideacomprehensiveguidetohelpyouuseFileZilla.Onceyou’reloggedin,selectRemoteSite.Gotowp_contentandlocatethePluginsfolder. Right-clickthefolderandrenameittoplugins_disabled.Trytoaccessyourwebsite.Iftheerrormessagenolongerappears,thenoneormorepluginsarecorruptedoroutdated.RenamethefolderbacktoPluginsandfollowthesametroubleshootingprocesswitheachplugin’sfoldertocheckwhichoneiscausingtheerror.Werecommendstartingwiththeonemostrecentlyinstalled.  5.Disablingthe.htaccessFile There’sapossibilitythatafaultyvariableorconflictingredirectrulesinyour.htaccessfileismakingyourwebsitegointoaredirectloop.Ifthat’stheissue,disablingthefileletsyouregainaccesstothesite.  Wewillwalkyouthroughtheprocessofdisablingthe.htaccessfileviaHostinger’sFileManager. AccesstheFileManagerviaHostinger’shPanel.Locateyour.htaccessfile.Right-clicktoRenamethefile.Youcanuse.htaccess_disabled,forexample. Nowcheckifthewebsiteisloadingcorrectly. Ifitworks,checkthe.htaccessfile’sconfigurationbyright-clickingonitandselectingEdit.Itshouldlooklikethedefault.htaccessconfiguration.Otherwise,deletethecontentfromthefileandpastethesedefaultrulesinstead: #BEGINWordPress RewriteEngineOn RewriteBase/ RewriteRule^index.php$–[L] RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule./index.php[L] #ENDWordPress Renamethefilebackto.htaccess,andyou’redone.Ifmisconfigurationsinthefilecausedtheredirectlooperror,thismethodshouldfixtheproblemimmediately. Sincereplacingyourprevious.htaccesssettingsmaybreakyourwebsitesettings,youshouldalwaysmakeabackupoftheoriginalfilebeforemakinganychanges. 6.TurnOfftheContentDeliveryNetwork(CDN)Temporarily  Anotherpossibleculpritofaredirectlooperrorisathird-partyserviceinstalledwithinyourhost.Inmostcases,it’stheCDNconfiguration.CDNisanetworkofproxyserversplacedindifferentlocationstoensurehighwebsiteloadspeed. TheproblemwithredirectloopsariseswhenyourCDNhasitsSSLoptionsettoFlexible,whichmeansitsendsunencryptedrequeststoyoursite’sserver. IfyourwebsiteisconfiguredtoredirectallHTTPrequeststoHTTPSwhenusingtheflexiblemode,itwillcausearedirectloopissue.  Ifthat’sthecase,configuringtheCDN’sSSLsettingstoFullorFull(strict)shouldsolvetheissueifyouhaveanactiveSSLcertificate.Beforedoingso,first,confirmthatyourCDNiscausingtheerrorbydisablingittemporarily. Forthefollowingtutorial,wewilluseCloudflare.HerearethestepsyoushouldfollowtodisableCloudflaretemporarily: FromtheCloudflaredashboard,navigatetotheOverviewtab. LocatetheAdvancedActionssectionatthebottomrightofthepage. SelectPauseCloudflareonSite. Ifyou’reusingHostingerasyourhostingprovider,gotoyourhPaneltodisableCloudflareandfixtheredirectloop.Here’showtodoit: NavigatetotheCloudflaremenuunderDomainsonyourhPaneldashboard.TurnofftheSSL/Encryptcommunicationsetting,andthenclickSave. AfterdisablingCloudflare,it’srecommendedtoclearthecacheoncemore. Conclusion Inthistutorial,youhavelearnedseveralmethodstofixtheERR_TOO_MANY_REDIRECTSerroronyourWordPresswebsite.Here’saquickrecapofthesemethods: DeletecookiesandbrowsingdataCheckandedittheURLsettingsUseaWordPressplugintodeletethewebsitecacheCheckanddisablefaultypluginsthroughanFTPclientDisableandeditthe.htaccessfileTemporarilydisabletheCDN Ifyouknowothermethodsyouwanttoshareorhaveanyquestionsabouttheredirectlooperror,leaveusacommentbelow. Theauthor TomasA. TomasisaseniorcustomersupportagentatHostinger.Besidesprovidingtop-notchtechnicaladviceonadailybasis,helikestocreatewebsitesanddovariouscodingsideprojects. MorefromTomasA. Relatedtutorials 10Nov• WordPress • Tools • IntroducingLiteSpeed–YourGo-ToWebsiteOptimizationTool SpeedisoneofthemajorfactorswhenitcomestoaWordPresswebsite’soverallperformance.Notonlydoesspeedcontributetothefirstimpression... ByNabillaR. 05Nov• WordPress • Plugins • HowManyPluginsAreTooManyinWordPress? PluginsareusefulforeveryWordPresssite,buthavingtoomanycanbedetrimentaltothewebsite’sperformance.However,itisnotthenumberof... ByTamaraJunor 29Oct• WordPress • Errors • WordPressChangesNotShowing?ThreeMethodstoFixWordPressNotUpdating MakingupdatestoaWordPresssiteandnotseeinganychangescanbeirritating.Somesituationsyoumighthaveencounteredare:Seeingchangeswhen... ByAstariSarosa Comments Leaveacomment PaulScott June192017 LogIntoReply Unfortunately,NONEofthesitesthatI'vevisitedoverthepast3daysaddressthisissueasitpertainstorunningWordPressunderIIS8.0onWindowsServer2012R2.NotethatthereisNO.htaccessfile,thereisonlyawp-config.phpfile.Ihavesearchedandsearchedandsearchedforasolutiontothisissue,withzeroluckthusfar.PleasenotethattheADMINarea(forWordPress),worksfine.ItisonlywhenItrytofireupthesiteitselfthatthis"toomanyre-direct"issuecomesup.Infact,manyofthesitesI'vevisitedstatethattheissueiscausedby"thehostingcompany."Unfortunately,IAMthehostingcompany,sothisdoesnothelpme.Pleasehelp!Thisisdrivingmecrazy! DomantasG. June192017 Hey, SorrybutHostingeroffersLinuxhostingonlyandwedon'treallyhaveexperienceinWindowsservers.Anyway,youmaywanttomakesurethatyouhavesetupWordPressonWindowsservercorrectly. PaulScott June202017 Ihavefoundthatthesolutiontothisproblemisasfollows: AddthefollowinglineofcodetotheFUNCTIONS.PHPfileinthewp-contentfolder,forthethemeyouareusing: //RemoveCanonicalURLfunctionality(asperURL:http://codex.wordpress.org): remove_filter('template_redirect','redirect_canonical'); DomantasG. June212017 Hey, Thankyouforsharingyourfind! Vadim February262018 hi.itoomuchgooogle,andsolutionwasborn: addinwp-config.phplines: define('FORCE_SSL_ADMIN',false); itsdisablesomefunction,buttrublewasgone. inmysituationimigrateto"https"from"http",anduseplugin-Renamewp-login.php mywp-config.phpwascontainlines: define('WP_SITEURL','https://mysite.com'); define('WP_HOME','https://mysite.com'); withoutline"define('FORCE_SSL_ADMIN',false);"ihaveloopredirects. henry April142018 LogIntoReply mywp-adminastoomanyredirects.ideactivated404&redirectplugins.Thanksforyourarticle,ithelpedalot:-) Nazreen May022018 LogIntoReply Yourarticlehelpedmealot!Ittookmeaweektoconfigureandfixalltheredirectissues.Manythanks! ArunKumar October282018 LogIntoReply Option-2resolvedmyproblemofTOOMANYREDIRECTSwhileaccessingwpadmin.ThanksaLot. Marina May262019 LogIntoReply Step2workedforme.ThankyouTomas! nmm June222019 LogIntoReply Hi thanksalotyousavedmylife addingsiteurlmanuallyinwp-config.phpresolvedtheloop bestregards UsmanQamar August282019 LogIntoReply Thanksbro. veryhelpfulinformation. tohsakarin October062019 LogIntoReply Thanksstep3workedforme udithasanjaya November302019 LogIntoReply Thankyousomuch,after7daysIfoundthegreatmanwiththistutorial.option5isworkwel Ramu July032020 LogIntoReply OSMandlovelyarticleandeasytofollow.Justonesmallchangemadetheday RizwanWaris July042020 LogIntoReply hi,unfortunatelynonoftheaboveworkedforme.IamtryingtoinstallfreshversionofWordPressandihavedeletedeverythingfrommywebsiteincludingdatabase.Wheniextractedthewpfolderinthepublic_htmlfolderthroughmycpanel,andtriedtoaccessmyurlwww.mydomain.comitisgivingmeerror"toomanyredirects.Igoogledanddideverythingpeoplementionedincludingclearcachebutinvain.cansomeonehelpmeout.? Roeland July182020 LogIntoReply ThankYou! CheckingandChangingURLSettingsManually Thishelped:) IwasinWordpressadmin,Icouldpreviewthewebsite,butnotopenitfrommydashboardorgoingtotheURL SusanForson August252020 LogIntoReply Thankyousomuch!IwasnotabletologintoWPadmin,soIwentintocPanelandeditedtheconfigfile.Ihaveneverdoneanythinglikethatbefore,butittotallyworked!!Thankyou! TomislavT. November062020 HeySusan!Gladtohearitworked.Editingconfigfilesandcodeseemsscaryatfirstbutit'snotthatdifficult,asthereareresourcesforeverything!:)Justmakesuretoalwaysmakeacopyofwhateveryouareediting,tonotlosetheoriginalfile!:) Skynet September252020 LogIntoReply Thatwasquiteamazing--thankyouforanawesomeArticle TomislavT. November182020 Alwayshappytohelp. HariShankar November032020 LogIntoReply sosohelpfullartical Gautami December022020 LogIntoReply FormethewoocommercepluginwascausingthetroublewhenIdeactivated(option4),itmysitewasfinallyopeningandiwasn'tgettinganymessagesregardingredirects.Disablingmy.htaccessfile(option5)alsoworkedbutwheniclickedtoedititthecodewastheexactsameasitshouldbesocheckoutallthepossibleoptionsbeforemakingchangesintheactualcode. DavidFønsbo February172021 LogIntoReply Addingthosetodefinestatementsworkedlikeamiracle!!!! EmmaY. May062021 HeyaDavid, Greattohearthataddingthoselinesofcodeworked:) LeaveareplyCancelreplyPleasefilltherequiredfields.Pleaseaccepttheprivacycheckbox.Pleasefilltherequiredfieldsandaccepttheprivacycheckbox.Youmustbeloggedintopostacomment. Trustpilot



請為這篇文章評分?