Loading...
 
Skip to main content

Broken ReWrite rule in .htaccess

Status
Open
Subject
Broken ReWrite rule in .htaccess
Version
3.x
Category
  • Error
Feature
Search engine optimization (SEO)
Resolution status
New
Submitted by
maclauk
Lastmod by
maclauk
Rating
(0)
Related-to
Description

On our site we use the short URLs enabled by the SEO feature. We have used the default TikiWiki .htaccess file.

One of our blogs has grown to a reasonable size and users of it were claiming that the link at the bottom of the page to the next set of entries wasn't working. I confirmed this to be the case.

Looking at the source loaded into my browser for the page on clicking the "next page" button the following link should have been called :

Copy to clipboard
/blog1?offset=20

Manually entering this link did not work either. However if I entered the full URL below I did get the blog posts I was hoping for:

Copy to clipboard
tiki-view_blog.php?blogId=1&offset=20


I therefore suspected that the ReWrite rule was not correct. The standard rule is:

Copy to clipboard
RewriteRule ^blog([0-9]+) tiki-view_blog.php?blogId=$1 [QSA,L]


This standard rule chops off the end of the requested URL after the blog number, thereby removing the &offset=20 parameter.

Files
  1. Htaccess
Solution

The ReWrite rule needs to be expanded to the following to preserve parameters after the blog number:

Copy to clipboard
RewriteRule ^blog([0-9]+)(.*)$ tiki-view_blog.php?blogId=$1$2 [QSA,L]


It is likely that this problem affects many TikiWiki features that use similar ReWrite rules.

Importance
3
Priority
15
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
2774
Created
Wednesday 30 September, 2009 10:33:47 UTC
by Unknown
LastModif
Saturday 06 July, 2024 10:21:44 UTC


Show PHP error messages