Category htaccess mod rewrite output ordering

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2007, 01:51 AM
New Pligger
 
Join Date: May 2007
Location: Denver, CO
Posts: 1
In beta version 9.5, it seems the ordering of mod rewrite output on admin_categories.php is incorrect.

My output goes something like this:

RewriteRule ^(all|Cat1|Cat2|CatN)/([^/]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|Cat1|Cat2|CatN)/?$ ?category=$1 [L]

Adding this to my htaccess file broke my links of the form /Category/Title.

I'm still a newbie at regex and mod rewrite things, but I think rewrite condition in the first line also matches the condition in the second line. Thus, the second line is never matched due to the [L] flag.

Anyhow, swapping the order of the 2 lines output above fixed my problem.

Thanks for all your hard work - it really is appreciated
Reply With Quote
  #2 (permalink)  
Old 05-10-2007, 10:03 AM
Wislon's Avatar
New Pligger
 
Join Date: May 2007
Location: Newfoundland, Canada
Posts: 2
Send a message via ICQ to Wislon Send a message via AIM to Wislon Send a message via MSN to Wislon Send a message via Yahoo to Wislon Send a message via Skype™ to Wislon
Hey there. The first line's rule should not ever match the next line's because the + after [^/] indicates 1 or more (not 0 or more like * indicates) characters that aren't of class forwardslash.

The ? after the final forwardslash indicates 0 or 1 characters (i.e. final forwardslash optional).

So the first one will only match things like Cat1/Story_Name or Cat1/Story_Name/ and the second one will only match Cat1 or Cat1/ and the URI terminating there. Things like Cat1// will not match either rule due to not having one or more non-forwardslash characters between the two forwardslashes (first rule) or not terminating after one forwardslash or the category name alone (second rule). Gnome sane?

Unless there's something I overlooked, I don't know why swapping them fixed your problem. I'm thinking there must be something else strange on the go there, possibly a non regex-related bug.

Edit: As an afterthought, if you have Category names with any characters that Pligg URL encodes (turns into something like %28) than make sure you change them back to the actual characters for the rewrites (you may need to escape them), because the rewrites look at the decoded characters. So if you have something like InternetRadio%28Streaming%29 then change it to InternetRadio\(Streaming\) for the rewrite

Last edited by Wislon; 05-10-2007 at 10:38 AM. Reason: addendum
Reply With Quote
  #3 (permalink)  
Old 05-13-2007, 07:56 PM
New Pligger
 
Join Date: Apr 2007
Posts: 9
I can confirm that this solved my htaccess problem as well with v9.5 Categories and user profiles were returning page not found errors. Thanks mspainhower!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control of meta description - categories Divisive Cotton Questions and Comments 71 03-29-2011 10:03 PM
Pligg Categories Yankidank Wiki Articles 1 12-17-2008 11:10 AM
How to show category keywords as text on the site? gnalkit Questions and Comments 4 11-26-2008 06:17 AM
htaccess URL rewrite webfinity Questions and Comments 1 03-22-2008 12:53 AM
[SOLVED] htaccess bug (mod rewrite) with category name containing '_' symbol ablaye Questions and Comments 2 01-26-2008 02:48 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development