Sunday, 2 June 2013

pagination /page/2 redirects to home page (domain.com)

pagination /page/2 redirects to home page (domain.com)

Either using wp-pagenavi or the standard wp pagination (posts_nav_link()) a click to mydomain.com/page/2 will result in a 301 redirect back to the home page (url = domain.com )
turning off pretty permalinks and using ?page=2 works.
Yes, I am using
$args['paged'] = get_query_var( 'page' );
$wp_query = new WP_Query( $args );
$posts = $wp_query->posts;
to modify the posts.
if I make it
$args['paged'] = 2;
It will show the second page of posts, but on the home page.
Yes, I have read several articles about not using a new query, but have determined that it is better for me if I do.
However, this redirection is happening before it ever gets to this, afaik. I'm sticking a die() in there but it doesnt die until it's redirected, and dies on the home page.
Nothing in my htaccess would do this
php_value max_execution_time 3600
#php_flag display_errors on
#php_value error_reporting 7
php_value upload_max_filesize 20M
php_value post_max_size 20M

RewriteCond %{HTTP_HOST} ^www.domain.com
RewriteRule (.*) http://domain.com/$1 [R=301,L]


RewriteRule ^wp-content/uploads/(.*) /uploads/$1 [QSA,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
This is a new problem, only occuring on a couple of sites out of many that are running on identical installs. I dont see any differences between working and non working.
So, if no one has the easy answer, where do I start to debug and find out where wp is deciding it needs to redirect to home?

No comments:

Post a Comment