[Solved]Pagination does not work correctly using mod_rewrite

All about webserver configurations, PHP and databases.

Moderator: Thorsten

Post Reply
Rokixz
Posts: 7
Joined: Wed Mar 13, 2013 6:27 pm

[Solved]Pagination does not work correctly using mod_rewrite

Post by Rokixz »

Hello,

Happy to be user for this system, but can't get it to work correctly using .htaccess file. Everything seemed to be good, but when category appears with pagination, pages doesn't work. For e.g. I'm trying to click on second page in category pager, it still shows Page 1 out of 2 Pages and the link is http://faq.balticservers.com/category/10/2/.html - as I know URL cannot be like that.

The .htaccess file I'm using:

Code: Select all

##
# phpMyFAQ .htaccess file for Apache 2.x
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# @author    Thorsten Rinne <thorsten@phpmyfaq.de>
# @author    Patrick Preuster <sica@php-q.net>
# @author    Matteo Scaramuccia <matteo@scaramuccia.com>
# @copyright 2004-2013 phpMyFAQ Team
# @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
# @link      http://www.phpmyfaq.de
# @since     2004-11-13

# always follow the symlinks
Options +FollowSymlinks -MultiViews -Indexes 

# if you want to use mod_rewrite, set this 'On'
RewriteEngine On

# the path to your phpMyFAQ installation
RewriteBase /

# Maintenance Section - Uncomment the lines below according to your need
# Write below your client IP address (e.g.: 127.0.0.1)
# if you need to keep your web access during maintenance
#RewriteCond %{REMOTE_ADDR}          !^127.0.0.1$
# Choose your way of closing the access to PMF:
# a. you can simply forbid access (HTTP 403 Error)
#RewriteRule ^(.*)$                  underMaintenance.html [F,L]
# b. return the user an explanation
#RewriteRule ^(.*)$                  underMaintenance.html [L]

# show all categories
RewriteCond %{REQUEST_URI}          /showcat\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=show [L,QSA]

# the search page
RewriteCond %{REQUEST_URI}          /search\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=search [L,QSA]

# the add content page
RewriteCond %{REQUEST_URI}          /addcontent\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=add [L,QSA]

# the ask question page
RewriteCond %{REQUEST_URI}          /ask\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=ask [L,QSA]

# the open questions page
RewriteCond %{REQUEST_URI}          /open\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=open [L,QSA]

# the help page
RewriteCond %{REQUEST_URI}          /help\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=help [L,QSA]

# the contact page
RewriteCond %{REQUEST_URI}          /contact\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=contact [L,QSA]

# the glossary page
RewriteCond %{REQUEST_URI}          /glossary\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=glossary [L,QSA]

# a page with a record (backward compatibility)
# * http://[...]/1_1_en.html
RewriteCond %{REQUEST_URI}              ([0-9]+)_([0-9]+)_([a-z\-]+)\.html$ [NC]
RewriteRule ^(.*)_(.*)_(.*)\.html$      index.php?action=artikel&cat=$1&id=$2&artlang=$3 [L,QSA]

# a category page with page count (backward compatibility)
# * http://[...]/category1_1.html
RewriteCond %{REQUEST_URI}              category([0-9]+)_([0-9]+)\.html$ [NC]
RewriteRule ^category(.*)_(.*)\.html$   index.php?action=show&cat=$1&seite=$2 [L,QSA]

# a category page (backward compatibility)
# * http://[...]/category1.html
RewriteCond %{REQUEST_URI}              category([0-9]+)\.html$ [NC]
RewriteRule ^category(.*)\.html$        index.php?action=show&cat=$1 [L,QSA]

# start page
RewriteRule ^index.html$                 index.php [PT]

# sitemap (backward compatibility)
RewriteCond %{REQUEST_URI}              sitemap-([a-zA-Z0-9]*)_([a-z\-]+)\.html$ [NC]
RewriteRule ^sitemap-(.*)_(.*)\.html$   index.php?action=sitemap&letter=$1&lang=$2 [L,QSA]

# a solution id page
RewriteCond %{REQUEST_URI}              solution_id_([0-9]+)\.html$ [NC]
RewriteRule ^solution_id_(.*)\.html$    index.php?solution_id=$1 [L,QSA]

# PMF faq record page
# * http://[...]/content/1/1/<LANGUAGE CODE>/<FAQ TOPIC>.htm
# * http://[...]/content/1/1/<LANGUAGE CODE>/<FAQ TOPIC>.html
RewriteRule content/([0-9]+)/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$     index.php?action=artikel&cat=$1&id=$2&artlang=$3 [L,QSA]

# PMF category page with page count
# * http://[...]/category/1/<PAGE NUMBER/<CATEGORY NAME>.htm
# * http://[...]/category/1/<PAGE NUMBER/<CATEGORY NAME>.html
RewriteRule category/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$   index.php?action=show&cat=$1&seite=$2 [L,QSA]

# PMF category page
# * http://[...]/category/1/<CATEGORY NAME>.htm
# * http://[...]/category/1/<CATEGORY NAME>.html
RewriteRule category/([0-9]+)/(.+)\.htm(l?)$    index.php?action=show&cat=$1 [L,QSA]

# PMF news page
# * http://[...]/news/<ID>/<LANGUAGE CODE>/<HEADER>.htm
# * http://[...]/news/<ID>/<LANGUAGE CODE>/<HEADER>.html
RewriteRule news/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$     index.php?action=news&newsid=$1&newslang=$2 [L,QSA]

# PMF sitemap
# * http://[...]/sitemap/<LETTER>/<LANGUAGE CODE>.htm
# * http://[...]/sitemap/<LETTER>/<LANGUAGE CODE>.html
RewriteRule sitemap/([^\/]+)/([a-z\-]+)\.htm(l?)$   index.php?action=sitemap&letter=$1&lang=$2 [L,QSA]

# PMF Google sitemap
# * http://[...]/sitemap.xml
# * http://[...]/sitemap.gz
# * http://[...]/sitemap.xml.gz
RewriteRule sitemap.xml$        sitemap.xml.php [L]
RewriteRule sitemap.gz$         sitemap.xml.php?gz=1 [L]
RewriteRule sitemap.xml.gz$     sitemap.xml.php?gz=1 [L]

# PMF tags page with page count
# * http://[...]/tags/<ID>/<PAGE NUMBER>/<HEADER>.htm
RewriteRule tags/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$   index.php?action=search&tagging_id=$1&seite=$2 [L,QSA]

# PMF tags page
# * http://[...]/tags/<ID>/<HEADER>.htm
RewriteRule tags/([0-9]+)/([^\/]+)\.htm(l?)$     index.php?action=search&tagging_id=$1 [L,QSA] 

# the instant response page
RewriteCond %{REQUEST_URI}          instantresponse\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=instantresponse [L,QSA]

# rest/json API
# * http://[...]/api/<ACTION>/<LANGUAGE CODE>/<...>
RewriteRule api/getVersion                        api.php?action=getVersion [L,QSA]
RewriteRule api/getApiVersion                     api.php?action=getApiVersion [L,QSA]
RewriteRule api/search/([a-z\-]+)/([a-z\-]+)$     api.php?action=search&lang=$1&q=$2 [L,QSA]
RewriteRule api/getCategories                     api.php?action=getCategories [L,QSA]
RewriteRule api/getFaqs/([a-z\-]+)/([0-9]+)       api.php?action=getFaqs&lang=$1&categoryId=$2 [L,QSA]
RewriteRule api/getFaq/([a-z\-]+)/([0-9]+)        api.php?action=getFaq&lang=$1&recordId=$2 [L,QSA]
Would be very glad if somebody could help me. Thanks for any answer.

P.S.

I'm using 2.8 RC2 version.

I'd like to change http://faq.balticservers.com/content/6/50/en/can-we-protect-you-from-ddos.html to other word, for e.g. contents123 - how can I do that. I'm very fresh with mod_rewrite :)
Last edited by Rokixz on Mon Apr 22, 2013 8:30 pm, edited 1 time in total.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Pagination does not work correctly using mod_rewrite

Post by Thorsten »

Hi,

I'll check it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Rokixz
Posts: 7
Joined: Wed Mar 13, 2013 6:27 pm

Re: Pagination does not work correctly using mod_rewrite

Post by Rokixz »

OK, please let me know if there are any solution, it's important when FAQ based on production. Thanks.
jason102178
Posts: 200
Joined: Tue Nov 02, 2010 9:08 am
Location: United States-Ohio
Contact:

Re: Pagination does not work correctly using mod_rewrite

Post by jason102178 »

Hi
thorsten will check on this issue after april 3

Best Regards,

Jason
phpMyFAQ Quality Assurance / Forum Moderator
Amazon.com Wishlist
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Pagination does not work correctly using mod_rewrite

Post by Thorsten »

Hi,

will be fixed with RC4.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
pt20100201
Posts: 134
Joined: Mon Feb 01, 2010 2:11 pm
Location: Porto . Portugal
Contact:

[ v.2.8.2] Category - pagination does not work on FAQs list

Post by pt20100201 »

[v. 2.8.2] Category - pagination does not work on it's FAQs list
.
Dear "Rokixz" and phpMyFAQ's Team

1.
We use phpMyFAQ's 2.8.2 version with mod_rewrite and we have the same problem[1]:
  • Pagination works in advanced search result, but
  • it doesn't work in a category FAQs list
Is it a recurrent issue or do you think that it may be related with our webserver / phpMyFAQ installation?

2.
It seems that pagination code isn't in a single file - are we wrong or just made a bad analysis of the code?

Thank in advance.

[1] Screenshot - pagination : correct behavior on the left (advanced search), wrong on the right (category's FAQ records) - URLs at image's lower end.
pt20100201-20131111-pagination-problem-v-2.8.2.png

[attachment=1]pt20100201-20131111-pagination-problem-v-2.8.2.png[/attachment]

..
Kind regards
2013-11-11
pt20100201
..
You do not have the required permissions to view the files attached to this post.
Post Reply