Redirect loop issue with WordPress, URL is not changing

If I go to www.domain.com it works fine. If I go to http://domain.com it gives me a redirect loop. I commented the .htaccess and it worked, but then I realised the redirects were caused by the WP application itself (if I exit() in the first line of the index.php both URLs work).

After many days trying to solve this problem, I started debugging the WordPress code and found the function wp_redirect on pluggable.php. It was just checking if it was porta8080.com.br, and redirecting to www.porta8080.com.br.

Read More

the point is that, the redirection wasn’t changing the URL. so it was being redirect everytime the page was loaded. I tried to do this verification in my own way in the very first line of index.php, but I got the same error.

I made it work with header('refresh:0,url=www.domain.com') in the first line of index.php, but it gets cached (probably) and stops working after a few hours.

why isn’t the URL changing? or how can I stop this cache with the second method?

any ideas?! it’s getting me crazy for over a week now!

Related posts