Page 1 of 1

Rewrite rule improvements nad 301 sugestion

Posted: Mon Sep 15, 2008 11:09 pm
by Greyer
Hi,

Is there a way for me to add a rule in the rewrite functionality so that it converts capital letter to small ones? Also is it possible to ignore punctuation in the title so that they are not added in the URL?

In this post for example - greyer.atsense.com/archives/Maybe-....html

I cann't use the custom permalink plugin since it can't use the /archive/ structure and I do want to be able to use punctuation in the title.

Also could someone create a plugin to create 301 redirects as I can't find any and I suck at programing?

Re: Rewrite rule improvements nad 301 sugestion

Posted: Tue Sep 16, 2008 1:27 pm
by garvinhicking
Hi!

That mechanism must be changed inside the file include/functions_permalinks.inc.php

The first function serendipity_makeFilename must be changed so that before the ending line "return $str;" you add this line:

Code: Select all

$str = str_replace('.', '', strtolower($str));
About 301 redirection, I can sadly only point out to search google for "rewriterule 301 .htaccess" to find examples on how to craft those.

HTH,
Garvin

Posted: Tue Sep 16, 2008 9:56 pm
by Greyer
I did that and it worked, but then I noticed a different problem - I can't find post with one word titles. The articles do appear on the homepage but when I click for the detailed review the server couldn't find it - "No entries to print".

I returned the original version of the file and tried again with a new post - same thing.

In case you are wandering I am running Serendipity 1.2, so it could be a bug in the older version which you already fixed. Let me know if that's the case.

Posted: Thu Sep 18, 2008 10:13 am
by garvinhicking
Hi!

This might happen when you do not use %id% in the URL and no permalink path prefix. How exactly did you configure your URLs and permalink paths?

Regards,
Garvin

Posted: Thu Sep 18, 2008 2:39 pm
by Greyer
I think I just removed the %id%

Currently my URLs look like this - mysite.com/archives/post-title.html

I am pretty new to this stuff so please bare with me :oops:

Posted: Thu Sep 18, 2008 4:16 pm
by garvinhicking
Hi!

The trouble is that s9y interprets single-word archive links as Month/Yearch archives. It only interprets it as a single posting, if at least one "-" occurs.

There are a couple ways to try to remove that situation:

1. Re-insert %id% into the URL (it will also speed up your blog!)

2. Insert a hardcoded "-" in the title of each posting, like /archives/post-%title%.html (or maybe /posts/archives/%title%.html, that could work)

3. Try to change the permalink for an entry to /postings/%title% while leaving the archive path (seperate config option) still set to "archive". This might have an impact on other parts of s9y, but I'm not sure.

4. Do not use blog entries with one word ;-) ;)

HTH,
Garvin

Posted: Thu Sep 18, 2008 4:58 pm
by Greyer
Yea, I am already using the 4th option, but thought I should let you know ;)

How does the %id% help speed up my blog? I don't have any complains yet but I have ~10 posts so far so there is not much the server could choke on. But if removing the id from the URL is going to create problems in the future I might as well bring it back.

Posted: Fri Sep 19, 2008 10:56 am
by garvinhicking
Hi!
How does the %id% help speed up my blog? I don't have any complains yet but I have ~10 posts so far so there is not much the server could choke on. But if removing the id from the URL is going to create problems in the future I might as well bring it back.
When an ID is contained in the URL, s9y immediately knows what to lookup. Without the ID, s9y needs to perform an additional database lookup for the current URL. This does not impact performance THAT much, but the fewer queries that need to be executed, the faster the blog.

HTH,
Garvin