category and post links

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
odyseusz

category and post links

Post by odyseusz »

hi
can you tell me how to:
change category link from domain.com/categories/my_category/
to domain.com/my_category/ ????

and posts links from domain.com/archives/post_name to domain.com/category_name/post_name ????
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

I tried to do exactly that through Serendipity configuration, and ran into loads of trouble.

The problem was that s9y uses its configuration to modify your .htaccess rewriting rules. If you don't include a subdirectory specifying categories, s9y writes a rule like "/anything gets mapped to /index.php?cat=anything".

If you want those URLs to redirect to a category listing, your best bet is to simply write your own rewriting rules; you'll need multiple rules, like "/cat1 gets mapped to /index.php?cat=cat1; /cat2 gets mapped to /index.php?cat=cat2; etcetera".

If you want s9y to use those URLs itself, well... I believe an event plugin would be necessary.

You could try using the s9y configuration, then manually modifying the rewriting rules. It'd need to be remodified every time you modified the categories, and any time the path configuration changed, but otherwise I believe it would work.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Serendipity does support creating custom permalinks, but you need directories for each ruleset, so you cannot simply redirect domains to use "/" as the path, but you need "my_categories/Category1" or so, with a constant "my_categories" prefix. Else, Serendipity couldn't decide whether you want to open an article, a feed, a category, an author or what else. The dir prefix really is a good thing to have, also for Visitors.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply