Home Blog PHP Wordpress did infinite 301 redirect loop
Wordpress did infinite 301 redirect loop
PHP
Written by Dicky   
Wednesday, 23 March 2011 13:36
AddThis Social Bookmark Button

When one of our customer installing a new Wordpress installation. I came across with issue where the page did infinite 301 redirect loop. In Firefox, it gave the following error message: The page isn't redirecting properly - Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

After searching around for answer, many of them pointed to modifying the .htaccess file or move the Wordpress files from sub-directory to the root. But since this particular customer is using Windows hosting and uses a sub-domain and a sub-folder for his Wordpress site, the proposed solution won't work. After further digging, I stumbled upon this support blog post, it turns out that I have to disable the redirect_canonical plugin in Wordpres. To do so, you need to add the following line:

remove_filter('template_redirect', 'redirect_canonical');

in functions.php under \wp-content\themes\default\ or whatever themes that you are currently using. No more redirection after that. I hope this help!