So, yesterday I had a question how to install the wordpress in the “/root” directory. I wasn’t very successful in that one and I forgo’ed on that one.
So, right now the wordpress is located under “/var/www/wordpress” (so it’s under separate folder) folder (I use Ubuntu 12.04 LTS, if it matters).
And my problem is that right after I had configured everything (everything was working like a charm there) I was redirected to the admin panel page. Everything was working fine up until the moment when I tried to visit the blog.
The URL address for my blog is: “blog.mysite.com”. That is why I use NGINX, because I have two different applications (and environments) on one server and I need to distinguish between them.
So, the fact is: blog.mysite.com/wp-admin (/wp-login.php) is working totally OK, but when I visit the front page: blog.mysite.com, it keeps telling me that there is an endless redirect loop (301 redirect according to nginx access log file).
In admin panel I have both “WordPress Address (URL)” and “Site address (URL)” set to: “http://blog.mysite.com“. Modifying either of them to something else, like: “http://blog.mysite.com/wordpress” is not helping at all!
“.htaccess” file is empty, but I’m using default permalinks, so should not be a problem (However, I’m not sure).
Both nginx and apache2 root directives are pointing to “/var/www/wordpress”.
Static files (css,js) are working, if it matters.
How can I fix this problem ? Any help is much appreciated!
Thank you in advance!
Not the prettiest fix, but removing the redirect filter in your theme
functions.php
file worked for me.From the link provided in OP’s answer:
WordPress did infinite 301 redirect loop
Finally, found a solution:
http://www.violato.net/blog/php/88-wordpress-did-infinite-301-redirect-loop
Hope this will help others that have the same problem as I did.
Thanks everyone.
I had a similar problem using Nginx as a reverse proxy for Apache.
After a few hours I found out it was caused by the
$_SERVER["REQUEST_URI"]
being set toindex.php
by Nginx instead of the actual url and WordPress was trying to removeindex.php
by redirecting to the url withoutindex.php
inwp-includes/canonical.php
.The solution for me is using something like this,
So adding the
$request_uri
fixed it.I had a lot of problems when switching from Apache to Nginx in the past, all solved when I purged Apache, which somehow was interfering with Nginx and caused problems to every server. Here is my wordpress configuration for Nginx, according to both Nginx and WordPress guides for each other:
I didn’t even have to change anything in the admin panel when switching servers, it just worked fine.
In my case, the redirect loop only affected wp-admin pages, so I added at the start of the line
and still works, plus the redirect canonical keeps doing its job on the front end!
I hope this helps someone else!
I was having this issue because I was using nginx to forward the request, but nginx wasn’t preserving the HOST header.
Once I added these values under my
location
block things started working as expected.