Page 1 of 1

Permalinks

Posted: Fri Dec 16, 2005 6:58 pm
by forefont
If I change the default permalinks from/to:

Archives: archives/%id%-%title%.html TO %title%.html
Categories: categories/%id%-%name% TO %name%

The site does not pick up the style sheets/looks unformatted and I am unable to login to admin. and need to reinstall the program again.

How can I change the permalinks to work as above?

Thanks.

Posted: Sat Dec 17, 2005 12:19 am
by mgroeninger
If you post a link it might be something someone can troubleshoot...

Generally these issues are caused by a change in the rewrite options, when url rewriting is not turned on...

Can you connect to http://server/serendipity_admin.php directly? it shouldn't use any rewrite once you are at that page, so from there you can make changes to your configuration.

Posted: Sat Dec 17, 2005 1:17 am
by forefont
I set up with mod_rewrite on,m it worked, and changed only those two elements, then it did not function.

I cannot connect to the admin URI directly, no.

Posted: Sat Dec 17, 2005 5:21 am
by mgroeninger
Then I might guess that changing the permalinks damaged the .htaccess file (file writes are weird sometimes)...

I had that happen to me once. It had an inappropriate character (I think it was a space) in the rewrite for the permalink. I just removed the permalink rewrite lines from the .htaccess and tried again... second time it wrote the file correctly.

I don't know a whole lot about the permalink functions, but I thought it was recommended that you keep the %id% value in the lines for performance reasons... it may also be that removing the folder from the permalink introduces a problem in the rewrite engine... I'm not an expert on that, though....

If you need a copy of an .htaccess file to compare with just post and I will try to get one up...

Posted: Sun Dec 18, 2005 7:10 pm
by judebert
In http://www.s9y.org/forums/viewtopic.php?t=3320, Garvin says you need some kind of constant subdirectory for each permalink type, so Serendipity knows whether it's displaying an archive, category, entry, or whatever. This is true, because Serendipity doesn't tell Apache to redirect every possible %id% or %title%: it translates %id% to "any number" and %title% to "any text".

Consider it from Apache's point of view. You pass in a URL as some text. Apache goes looking through it and does some string substitutions:

Code: Select all

categories/<something> gets changed to <s9y_dir>/index.php?cat=<something>
archives/<something>.html gets changed to <s9y_dir>/index.php?archive=<something>
It's easy to see that /categories/news needs to be changed to a category.

Now consider more general rules:

Code: Select all

<something> gets changed to <s9y_dir>/index.php?cat=<something>
<something> gets changed to <s9y_dir>/index.php?archive=<something>
What would you do with just /news? What about /january? There's no 'specifier', so there's no way to tell the difference between an archive and a category. Apache will see only text and try to change every URL to an archive.

If you understand mod_rewrite, you can directly modify your .htaccess file. I do exactly this on my current site, because I want to keep the old static pages around until I'm ready to set my blog free. You could add a rule for every category on your blog:

Code: Select all

"/news" goes to "<s9y_dir>/index.php?cat=news"
"/pictures" goes to "<s9y_dir>/index.php?cat=pictures"
"<something>" goes to "<s9y_dir>/index.php?archive=<something>"
...and so on. But then you'd need to add a new rule every time you added a new category, a new entry, or any other new item without a specifier. Major PITA, especially when you forget (and your visitors can't find your link), or when something overwrites your custom .htaccess file (and you have to rewrite it from scratch, because you didn't keep a backup, did you?).

End result: if you don't feel like messing with your .htaccess directly, always include some unique 'specifier' for each type of permalink. That way Apache can figure out how to make its changes, and Serendipity will know what to do.

Posted: Sun Dec 18, 2005 7:34 pm
by forefont
Thank you for your time and such a comprehensive reply.

The default method adds another level of directory structure to URIs and from an SEO stance, the more levels of recursion to a URI, the less weight given to URIs bedded down in these layers.

If I want:

foo.com/fishing/salmon.html
foo.com/hunting/deer.html

I should not have to state:

foo.com/category/fishing/salmon.html
foo.com/category/hunting/deer.html

I realize that the program does that as not all URIs are category pages, they could be news, etc., but as I am running this as a CMS for websites rather than a blogging tool, it is, as you say, a PITA.

I'll add this under feature requests.

Thanks again.


(edited: there seems to be no featurw request section :-( )

Posted: Mon Dec 19, 2005 10:01 am
by garvinhicking
We have a feature request tracker on our SourceForge.net site (see www.s9y.org).

However, I can already tell you that such a Feature request will most likely not be implemented.

The reason is, from a User point of view, that URLs like "/articles" or "/categories" indeed is very useful. And actually s9y is made for users and bloggers and not for the specific needs of SEOs.

And technically it's not solvable to remove such a directory prefix, just like judebert already perfectly indicated. You can, however, use the custom_permalinks plugin outside of the /archives directory to use any custom links. So I guess that should do the trick for you, without changing the internal permalinks.

Best regards,
Garvin