WordPress.org

Ready to get started?Download WordPress

Forums

Redirect Loop on Blog Home Page (26 posts)

  1. bkparikh
    Member
    Posted 3 years ago #

    When I visit my blog homepages http://magoosh.com/gre or http://magoosh.com/gmat I get a redirect loop. But if I refresh the page, the error goes away and I can get to the homepage. This is happening with both Firefox and Chrome browsers.

    I don't seem to have an issue if I go directly to a post. I've tried removing various plugins to find the culprit but have had no luck. In addition, I recall seeing this issue from the moment I set up WP3.0 multi-site.

    I'd love some help. Thanks!

  2. Are you using any caching plugins on your WP install or your server?

  3. Did you check with your host to see if they let you run multisite?

  4. bkparikh
    Member
    Posted 3 years ago #

    @Ipstenu I was using WP Super Cache, but I deactivated and deleted it and am still seeing the issue.

    @Andrea_r I use Amazon Web Services. The sites seem to be running fine except for when I hit the homepage - in which case I need to refresh

  5. Amazon Web Services ... Don't they do a lot of siloing and caching on THEIR end?

  6. bkparikh
    Member
    Posted 3 years ago #

    I'm not sure, but I can look into it. Do you know why caching would cause a redirect loop? I'm also confused as to why this only happens the first time I hit the site, but when I refresh the issue goes away.

  7. The refresh is the key. Something cached the bad login info. Since it happens to everyone, it's probably the server and not your PC.

  8. bkparikh
    Member
    Posted 3 years ago #

    I now have more information. I think the issue may be because I have a multisite install on WP 3.1 with the files in a wordpress directory within the root rather than directly in the root directory. I've tried a few things to move the install up a level to the root to no avail. Any ideas?

  9. I think the issue may be because I have a multisite install on WP 3.1 with the files in a wordpress directory within the root rather than directly in the root directory.

    Are you trying to access WordPress as if it WAS in root, but with a non-URL location? That is you go to domain.com but the code is all in domain.com/wordpress ? Cause... yeeeeeah, that'd be weird.

    You CAN move it, but it's tricky. See http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite

  10. bkparikh
    Member
    Posted 3 years ago #

    Yes, I go to domain.com to access my wordpress install but all the code is in domain.com/wordpress. I know you can do this with a single install http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory, but I guess I shouldn't have done this with multisite. I installed multisite back in August. As far as I can remember I've always had this redirect problem, but since I could get around it by refreshing a few times I foolishly thought it would go away at some point.

    When I go to domain.com to access the main site, I have no problems with redirects. I access my other sites at: domain.com/site1 and domain.com/site, and that's when I get the "too many redirects" error.

    Last night I copied everything from the domain.com/wordpress directory to the domain.com/directory. Also, both .htaccess and wp-config seemed to be configured properly for access at domain.com. I also changed the DocumentRoot to use the domain.com directory. I checked the database and while there are references to the domain.com/wordpress path, most were for images and comments (so those broke), but nothing related to the actual path.

    And even with this, I would still get the redirect error. I'm pretty stuck at this point...

  11. I guess I shouldn't have done this with multisite.

    Yep :) Don't do it, doesn't work, causes problems.

    Looking at your list of what you did, you did NOT make all the changes needed.

    Look at wp_blogs and (I think) wp_sites.

    You ACTUALLY need to search for the foldername on it's own, NOT domain.com/foldername

  12. bkparikh
    Member
    Posted 3 years ago #

    I actually manually checked wp_blogs and wp_site, and didn't find any reference to the foldername. I just checked again.

    wp_site looks like this (there's only 1 row)
    domain: domain.com
    path: /

    wp_blogs looks like this (4 rows)
    domain: domain.com (for all 4)
    path: / ; /site1/ ; /site2/ ; /site3/

  13. Well. That's weird. Though....

    http://magoosh.com/gre gets a loop. http://gre.magoosh.com/ works fine.

  14. bkparikh
    Member
    Posted 3 years ago #

    Well gre.magoosh.com is not on the wordpress install. That's our application and is complete custom, in fact it's on a different server.

    The wordpress install is for the respective blogs of each application. The site structure is:
    magoosh.com
    magoosh.com/gre
    magoosh.com/gmat

  15. Where is http://gre.magoosh.com/ pointing to?

    On MY server, subdomains are located in /public_html/subdomainname (and yes, you can get to subdomains at domain.com/subdomain for most servers... unless you redirect them around).

    In your case this would be /public_html/gre ... and that would kinda conflict with magoosh.com/gre you see. Apache thinks they're BOTH the same thing.

  16. bkparikh
    Member
    Posted 3 years ago #

    gre.magoosh.com has an ANAME record to a completely different ip address (different server)

    The other issue is that I get the redirect error on other pages like magoosh.com/home (thats a page under the magoosh.com site not a separate site like magoosh.com/gre) and there is no subdomain at home.magoosh.com

  17. Oh good (about the gre.magoosh.com and BTW, I LOVE saying 'magoosh' for some reason!).

    The other issue is that I get the redirect error on other pages like magoosh.com/home (thats a page under the magoosh.com site not a separate site like magoosh.com/gre

    Did we ever go over your .htaccess? If not, can you share the whole thing here? Yeah, I know it may be long and icky.

  18. bkparikh
    Member
    Posted 3 years ago #

    Sure, sorry for the delay; had a service outage, ugh.

    **************
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    **********************

  19. That's the whole thing? Nothing extra in there? (Yes, I mean BESIDES the wordPress stuff).

    FYI, for a more better .htaccess for WP, do this:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress

    MINOR changes, but it may speed things up anyway.

  20. bkparikh
    Member
    Posted 3 years ago #

    Yes, that's the whole thing. I replaced mine with yours. Unfortunately, still seeing the issue.

  21. I didn't think it'd fix it, personally, but it's a better .htaccess.

    Do you have any redirect plugins? Simple tags? Anything that plays with your URLs?

  22. bkparikh
    Member
    Posted 3 years ago #

    Ah, now I understand re: .htaccess

    I do use permalinks. I don't think I have any other redirect plugins.

  23. bkparikh
    Member
    Posted 3 years ago #

    I did some more debugging and am getting this type of output in the logs when I try to go to "http://magoosh.com/home"

    [Wed Mar 30 15:32:41 2011] [debug] mod_cache.c(131): Adding CACHE_SAVE filter for /home/
    [Wed Mar 30 15:32:41 2011] [debug] mod_cache.c(138): Adding CACHE_REMOVE_URL filter for /home/
    [Wed Mar 30 15:32:41 2011] [debug] mod_cache.c(282): cache: running CACHE_OUT filter
    [Wed Mar 30 15:32:41 2011] [debug] mod_cache.c(296): cache: serving /index.php

    I get a similar output when I try to go to http://magoosh.com/gre with home replaced with gre

  24. Well... Okay. Is that the experimental mod cache thing for apache 2? Ca you turn it off for a test?

  25. bkparikh
    Member
    Posted 3 years ago #

    Wow, well...I'm not celebrating yet, but I added the following lines to my .htaccess as part of disabling cache, thanks to this post (http://mirror.dabase.com/e/04038/) and your advice, and it seems to be working!

    Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
    Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    Header set Pragma "no-cache"

    I'll keep you posted. I can't thank you enough for helping me think through this!

  26. Not a problem :) I like new/weird problems like this! Helps me think sideways!

    Not that turning off cache is a great thing, but clearly there's a conflict going on there. A google shows me that a LOT of apps have trouble with the Apache 2.2 version of mod_cache.c though.

    http://www.mail-archive.com/dev@httpd.apache.org/msg35291.html

    That's sort of distressing!

Topic Closed

This topic has been closed to new replies.

About this Topic