Help - Search - Members - Calendar
Full Version: Mt-hack :: Pagination Problem With Rewrite Rule
Movable Type Community Forum > Additional Resources > Plugin Development and Usage
jrgeoffrion
I've installed Pagination from MT-Hack and I'm having a little trouble with the RewriteEngine code. I was able to generate the page code at the bottom of my index file.

The problem is that when I click on one of the page links, I get a "Page Not Found" error. The original code for the .htaccess is as follows:

CODE
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
RewriteRule ^(.*)$ <mt:CGIRelativeURL>plugins/Pagination/pages.cgi?blog_id=<mt:BlogID>&lastn=10&idx=<mt:IndexBasename><mt:BlogFileExtension>&path=<mt:BlogRelativeURL>$1 [L,QSA]


Unfortunately, the server didn't interpret the <MT:> codes so I changed them to - what I thought - were their values, which is this:

CODE
http://www.jrgeoffrion.com/cgi-bin/MT/plugins/Pagination/pages.cgi?blog_id=1&lastn=1&1&idx=http://www.jrgeoffrion.com/blog/index.html&path=http://www.jrgeoffrion.com/blog/index.html&page=2


That doesn't seem to work...

Anyone can suggest a new RewriteRule line for my .htaccess?




jimwalczak
QUOTE (jrgeoffrion @ Feb 12 2008, 10:08 AM) *
I've installed Pagination from MT-Hack and I'm having a little trouble with the RewriteEngine code. I was able to generate the page code at the bottom of my index file.

The problem is that when I click on one of the page links, I get a "Page Not Found" error. The original code for the .htaccess is as follows:

CODE
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
RewriteRule ^(.*)$ <mt:CGIRelativeURL>plugins/Pagination/pages.cgi?blog_id=<mt:BlogID>&lastn=10&idx=<mt:IndexBasename><mt:BlogFileExtension>&path=<mt:BlogRelativeURL>$1 [L,QSA]


Unfortunately, the server didn't interpret the <MT:> codes so I changed them to - what I thought - were their values, which is this:

CODE
http://www.jrgeoffrion.com/cgi-bin/MT/plugins/Pagination/pages.cgi?blog_id=1&lastn=1&1&idx=http://www.jrgeoffrion.com/blog/index.html&path=http://www.jrgeoffrion.com/blog/index.html&page=2


That doesn't seem to work...

Anyone can suggest a new RewriteRule line for my .htaccess?


Hey JR

I'm not sure it's a ReWrite problem

I'm having a similar issue (ONLY on the main index). The Category pages appear to work great. I was also having an issue on some of my subsites. They reside at http://Subdomain.Maindomain.com.

So I edited my mt-config file to add the following:
CODE
AdminCGIPath http://Mydomain.com/path/to/cgi-bin/


Then I edited the Pagination .htaccess to:
CODE
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
RewriteRule ^(.*)$ <mt:AdminCGIPath />plugins/Pagination/pages.cgi?blog_id=<mt:BlogID>&lastn=7&idx=<mt:IndexBasename><mt:BlogFileExtension>&path=<mt:BlogRelativeURL>$1 [L,QSA]


That worked great for all of the subsites and categories. Although I am still getting this error on the main site index.php
CODE
Can't locate object method "build" via package "Force" (perhaps you forgot to load "Force"?) at lib/Pagination/App/Viewer.pm line 330.


Truly weird! I even tried copying the subsites Main_Index and tried it out on the main site - still a no go. I'm really starting to suspect another bug in MT4.1

I don't even pretend to be a code expert. But here's what I found from line 171 - 175 of Pagination Plugin:
CODE
   $html = view_index(
    BlogID   => $fi->blog_id,
    Template => MT::Template->load( $fi->template_id ),
     Force    => 1,
     Page     => $page,


Here's the code from line 330 of the Pagination Plugin (mind you it works great every where except home site Main_Index:
CODE
  my $html = $tmpl->build($ctx);


UPDATE:
In an email conversation with Mark Carey (developer of Pagination) - he thought that MY issue might be database related. It in fact was. Sometime ago when during a databse update the mt_fileinfo for blog#1 ended up with 2 entires. One referred to (fileinfo_file_path) /my/old/server and the other /my/new/server

I delted the table entry for the file that had the old server reference - rebuilt blog#1 in MT - and like magic it worked.

Thanks to Mark for some great products over at http://mt-hacks.com and for his support. Every plugin I have ever bough from him is worth every penny!
jrgeoffrion
QUOTE (jimwalczak @ Apr 12 2008, 07:56 PM) *
Then I edited the Pagination .htaccess to:
CODE
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
RewriteRule ^(.*)$ <mt:AdminCGIPath />plugins/Pagination/pages.cgi?blog_id=<mt:BlogID>&lastn=7&idx=<mt:IndexBasename><mt:BlogFileExtension>&path=<mt:BlogRelativeURL>$1 [L,QSA]


That worked great for all of the subsites and categories. Although I am still getting this error on the main site index.php


Jim,

Thanks for the reply. Where did you put the .htaccess file? In the blog "root" (main publishing location) or in the /plugin/pagination/ directory or somewhere else?
michaelwebsterlaw
I have had the same problem, wrote Mark twice about it, and have heard nothing back.

I bought the plugin, so I do expect some level of support.
desperado
Regarding making this work with a subdomain (and keeping the subdomain address in the address bar), this seems to work for me:

CODE


RewriteEngine on

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

RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
RewriteRule ^(.*)$ <mt:CGIRelativeURL>plugins/Pagination/pages.cgi?blog_id=<mt:BlogID>&lastn=10&idx=<mt:IndexBasename><mt:BlogFileExtension>&path=<mt:BlogRelativeURL>$1 [L,QSA]

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.