Go Back   Pligg Forum > Pligg Development > Bug Report
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-08-2007, 11:51 PM
mspainhower mspainhower is offline
New Pligger
 
Join Date: May 2007
Location: Denver, CO
Posts: 1
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Category htaccess mod rewrite output ordering

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
Sponsored Links
  #2 (permalink)  
Old 05-10-2007, 08:03 AM
Wislon's Avatar
Wislon Wislon is offline
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
New Pligger
 
Join Date: May 2007
Location: Newfoundland, Canada
Posts: 2
Downloads: 4
Uploads: 0
Thanks: 0
Thanked 1 Time in 1 Post
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
__________________
- Wilson

Last edited by Wislon : 05-10-2007 at 08:38 AM. Reason: addendum
Reply With Quote
  #3 (permalink)  
Old 05-13-2007, 05:56 PM
scubaguy scubaguy is offline
New Pligger
 
Join Date: Apr 2007
Posts: 10
Downloads: 25
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

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
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
bold the main category, but unbold the subcategory? abcdefgary Pligg Templates 11 01-28-2008 04:15 PM
Rewrite '&' category? treelovinhippie Bug Report 1 04-23-2007 12:35 AM
[Fixed] Ampersand (&) in Category name shows All Biomech Bug Report 5 03-16-2007 06:02 PM
new category code - improvements? cruci Pligg Mods 4 01-06-2007 12:35 PM


LinkBacks Enabled by vBSEO 3.0.0