WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Blog posts redirecting to Home Page (15 posts)

  1. DoctorDR
    Member
    Posted 3 years ago #

    A really frustrating problem arose this afternoon that I guess must have arisen when I was disabling a plugin. Basically if I click on a blog post (or even just enter its URL in the browser window) it redirects to the home page. The same thing happens whether the home page is a blog listing or activity listing.

    My config is pretty standard WP3.12 BP 1.28, all the usual plugins. I’m an experienced WP developer so I know the score. I disabled all plugins, then reverted the site back to TwentyTen to then start adding the various bespoke elements back again. The permalinks are fine with TwentyTen, but as soon as I reinstall the BP default theme (which is a parent of my custom theme) the problem resurfaces. When I change permalink settings in admin back to the default (i.e. ugly) format, then the problem is resolved and clicking on an index blog entry takes me through to the single.php page.

    For clarification I am only running a single .htaccess file which is in the root of my site, WP is installed in the root also and there are no other applications on this domain. I can’t give you a link to the site, because the domain is hidden behind a redirect (which goes back to our main site), as we get ready to make this new site live.

    I have reloaded a fresh install of Buddypress, with a fresh BP default, but the problem persists, which means it must be an error in the database. I’ve also played around with my .htaccess file, removing and then restarting with a fresh copy, and this is the same .htaccess file that I’m using on 5 other WP sites that I run.

    Looking into the DB I can see that the redirects column in wp-options is pretty large and I would imagine this is where the problem stems from, but I’m not comfortable manually editing this table.

    Any thoughts, experiences or suggestions? My next step is to reinstall on a fresh DB, then try and recover the tables containing posts and other non-config data, which will obviously be a PITA.

    The last 12 hours history in my error log looks like this:

    [Thu May 05 22:53:01 2011] [alert] [client 184.106.221.215] /home/public_html/site.com/public/htdocs/.htaccess: RewriteRule: bad argument line '^([_0-9a-zA-Z-]+/)?files/(.+)'
    [Thu May 05 22:54:01 2011] [alert] [client 184.106.221.215] /home/public_html/site.com/public/htdocs/.htaccess: RewriteRule: bad argument line '^([_0-9a-zA-Z-]+/)?files/(.+)'
    [Fri May 06 09:01:04 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/wp-content/themes/images, referer: http://site.com/wp-content/themes/themename/style.css
    [Fri May 06 09:01:09 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/blog, referer: http://site.com/
    [Fri May 06 09:01:57 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/wp-content/themes/images, referer: http://site.com/wp-content/themes/themename/style.css
    [Fri May 06 09:02:03 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/blog, referer: http://site.com/
    [Fri May 06 10:15:05 2011] [error] [client 86.137.115.250] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://site.com/wp-content/themes/themename/style.css
    [Fri May 06 10:15:10 2011] [error] [client 86.137.115.250] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://site.com/
    [Fri May 06 10:16:05 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/wp-content/themes/images, referer: http://site.com/wp-content/themes/themename/style.css
    [Fri May 06 10:16:13 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/wp-admin/network/images, referer: http://site.com/wp-admin/network/
    [Fri May 06 10:17:03 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/blog, referer: http://site.com/

    So basically what seems to be happening is the server looks for /public/htdocs/blog, doesn’t find it and then redirects to the home page by default.

    The REALLY frustrating thing is that it worked fine up until yesterday, we were just about to make the site live when this bug appeared.

    Note: my httpd.conf for this domain is set up to allow mod rewrites, my .htaccess file in the root directory is as per any other WP multisite installation (with subdirectory format).

    It must be something REALLY simple, but I'm too close and cannot see it.

  2. Looking into the DB I can see that the redirects column in wp-options is pretty large and I would imagine this is where the problem stems from, but I’m not comfortable manually editing this table.

    Any thoughts, experiences or suggestions? My next step is to reinstall on a fresh DB, then try and recover the tables containing posts and other non-config data, which will obviously be a PITA.

    Manually editing those tables would be less of a PITA. ;)

    Okay, best guess I can figure is whatever plugin you had disabled mucked things up big time.

    BP requires pretty permalinks though, so if you;re still on default ugly ones, that's why your BP links don't work.

  3. When I change permalink settings in admin back to the default (i.e. ugly) format, then the problem is resolved and clicking on an index blog entry takes me through to the single.php page.

    What's your .htaccess look like?

    Did you do anything like remove the blog slug from your site?

  4. DoctorDR
    Member
    Posted 3 years ago #

    Thanks for getting back to me Andrea, yeah I'm guessing it was a plugin but I'm not sure which one..

    Permalinks are set within WP-admin, but each post just redirects back to index.php. Links throughout the rest of the site are fine. If I switch off permalinks and use the default/ugly format then the links work fine - but I realise that's not a workable solution for BP which requires permalinks to be working.

    Unless anyone has any advice about manually editing the DB, then I'll probably have to reinstall WP/BP and 'hope' it doesn't happen again. Darn, but I hate bypassing a problem without fixing it though..

  5. DoctorDR
    Member
    Posted 3 years ago #

    What's your .htaccess look like?

    Did you do anything like remove the blog slug from your site?

    .htaccess file is

    # 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

    And No, I haven't removed the blog slug from the site. The permalink format of my posts are..

    http://sitename.com/blog/2011/05/sample-post/

    Puzzling eh?

  6. DoctorDR
    Member
    Posted 3 years ago #

    Btw, user blogs (i.e. those with a URI format such as http://sitename.com/films/2011/04/26/this-is-a-post/ are just peachy and redirect fine, so it's just posts with a /blog slug.

  7. .htaccess looks fine (that's the whole thing? No other redirects? No plugins doing redirects? Any caching plugins? No actual folder named /blog/ sitting out there?)

    Have you tried turning off all plugins?

    The odd(er) thing it this:
    [Thu May 05 22:53:01 2011] [alert] [client 184.106.221.215] /home/public_html/site.com/public/htdocs/.htaccess: RewriteRule: bad argument line '^([_0-9a-zA-Z-]+/)?files/(.+)'

    I've never seen that error before!

    Side note:

    [Fri May 06 09:01:57 2011] [error] [client 86.137.115.250] File does not exist: /home/public_html/site.com/public/htdocs/wp-content/themes/images, referer: http://site.com/wp-content/themes/themename/style.css

    Looks like your style.css has a typo. It's looking one folder up for images.

  8. DoctorDR
    Member
    Posted 3 years ago #

    .htaccess looks fine (that's the whole thing? No other redirects? No plugins doing redirects? Any caching plugins? No actual folder named /blog/ sitting out there?)

    Have you tried turning off all plugins?

    The odd(er) thing it this:
    [Thu May 05 22:53:01 2011] [alert] [client 184.106.221.215] /home/public_html/site.com/public/htdocs/.htaccess: RewriteRule: bad argument line '^([_0-9a-zA-Z-]+/)?files/(.+)'

    I've never seen that error before!

    I've got one other redirect, which is positioned 'above' the wordpress entries, but all that does is keep the site private whilst development is completed.

    <IfModule mod_rewrite.c>
      Options +FollowSymLinks
      RewriteEngine On
      RewriteBase /
    	RewriteCond %{REMOTE_HOST} !^99\.999\.999\.999
    
    	RewriteCond %{REQUEST_URI} !/mypage\.html$  
    
    	RewriteRule .* http://www.sitename.com [R=302,L]
    </IfModule>

    I have no caching plugins installed yet, no folder named /blog and all the plugins are switched off (apart from buddypress).

    Next step is probably to look through each of the plugins and see if any redirects are being set..

    I'm also taking a look at Jeff Sebring's instructions on removing the blog slug, but thus far whenever I remove blog from the permalink, it returns again once the permalinks settings are saved in site admin.

  9. I don't think your rewrite would cause this, but you can always turn it off for a quick test.

    I'm also taking a look at Jeff Sebring's instructions on removing the blog slug, but thus far whenever I remove blog from the permalink, it returns again once the permalinks settings are saved in site admin.

    Yeah, that's basically what happens as of 3.1 :/ I tell people to leave /blog alone for now.

    I would just turn off all plugins except BuddyPress, personally, see if it works.

  10. DoctorDR
    Member
    Posted 3 years ago #

    Thanks, yes I've tried all of those things.

    Oh well, I'll take one last look around the plugins (to see which one might have caused the problem) and then it looks like I'll need to reinstall WP/BP again and then try and knit the DB back together again..

  11. DoctorDR
    Member
    Posted 3 years ago #

    Just to keep everyone in the loop. I've been trying out a few release candidate plugins and I suspect that one of these is the cause of my problems.

    I am looking into $wp_rewrite->flush_rules() to see if by flushing out the redirect rules, then re-saving permalinks can cure the problem.

    In theory this is already built into the wordpress permalink.php page - therefore whenever a new permalink structure is saved, it flushes and then saves this new structure. That's not working for me at the moment, so I will recreate the function and run it manually.

    Fingers (and toes) crossed...

  12. dlawton
    Member
    Posted 3 years ago #

    Had the same problem after upgrading WP core to 3.1.2

    After reading this post I went into setttings->permanlinks and just clicked the save button and the problem seems to have been resolved.

  13. Bilal Ahmad
    Member
    Posted 2 years ago #

    dlawton thank you for this very easy solution. I was facing the same issue and it is now working.

  14. geraldinebcl
    Member
    Posted 2 years ago #

    I had done a put new settings for my posts, including a lot for W3 cache and Yoast SEO, and all of the sudden no posts or page would open anymore. I found this, and dlawton's simple solution did it. So happy! Thank you!

  15. succinctideas
    Member
    Posted 2 years ago #

    Got the same issue viz: /blog displays home page
    Changing to ugly permalinks doesnt work for me :(
    phomedia or thesis 1.8 theme shows the issue
    Twenty Ten theme works OK
    Turned off all plugins

    Any help appreciated as Im pulling my hair out :(

    Cheers
    Pete

Topic Closed

This topic has been closed to new replies.

About this Topic