Making s9y permalinks match old Wordpress permalinks

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
psiege
Regular
Posts: 52
Joined: Thu Mar 27, 2008 4:21 pm

Making s9y permalinks match old Wordpress permalinks

Post by psiege »

I'm switching from Wordpress to s9y for security reasons. I'd like to be able to retain the location of all of my old posts. However, from what I read, s9y permalinks have to end in .html or .htm and my wordpress permalinks do not. Additionally, when I remove the id tag from the s9y permalinks rule, clicking the post title or read more link takes me to an empty page. Any suggestions?

Here's how my wordpress permalinks are formatted:
http://www.mydomain.com/blog_root_folde ... postname%/

I'd like to have s9y do the same for me. Is it possible?

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Making s9y permalinks match old Wordpress permalinks

Post by garvinhicking »

Hi!

The core problem of this is that s9y needs a fixed "prefix" for the URL patterns.

So a permalink like this:

Code: Select all

posts/%year%/%month%/%day%/%title%/
would actually work (it does on my test install, using mod_rewrite), because of the "/posts/" fixed prefix.

Would that be an option? You could try to use a custom rewrite rule to forward your old URLs with something like this in .htaccess:

Code: Select all

RewriteRule ^(/[0-9]{4}.*)$ /posts/$1 [L,QSA]
HTH,
Garvin

(Note that you CAN omit .htm/.html in the permalink patterns, as long as you can live with also removing %id% frmo the permalink, because then s9y will match permalinks by Database, not by URL regexp matching)
# 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/
psiege
Regular
Posts: 52
Joined: Thu Mar 27, 2008 4:21 pm

Post by psiege »

Thanks for the reply Garvin!

I've tried your sample permalink, and I'm running into the same issue as before. My exact permalink right now is:

Code: Select all

posts/%year%/%month%/%day%/%title%/
When I click on the post title, or the "continue reading" link, I get a page that says "No entries to print".

If we can get your idea working, I'd be very grateful. :)

Thanks again for the help. The support here is great! I think switching over to s9y was the right decision. Now, if only I can get these little bugs worked out.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Did you also change your "archives" pattern from "archives" to "posts"?

And you are using mod_rewrite, right? Did you check if your serendipity_permalinks DB table contains the URLs in the right format? They should be there automatically.

HTH,
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/
psiege
Regular
Posts: 52
Joined: Thu Mar 27, 2008 4:21 pm

Post by psiege »

Thanks! I forgot to enable mod_rewrite, it's working like a charm now. :oops:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Phew! :-)

If it only always were as easy. Have fun using s9y, and come back if you face more issues or have questions. :-)

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/
psiege
Regular
Posts: 52
Joined: Thu Mar 27, 2008 4:21 pm

Post by psiege »

Well, only one thing left before I can launch this thing, the rewrite of my old URLs so that all of my old post links work with my new post links (Wordpress to Serendipity).

Here's an example of an original link (this is on a shared host):

Code: Select all

root/public_html/pcdblog/YEAR/MONTH/DAY/title-of-post/
Here's an example of the new links:

Code: Select all

root/public_html/blog/posts/YEAR/MONTH/DAY/title-of-post/
I'm hoping someone can assist me in writing a .htaccess rewrite that will point the old posts to the new ones.

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Did you already try the rule I posted earlier:

Code: Select all

RewriteRule ^(/[0-9]{4}.*)$ /posts/$1 [L,QSA] 
?

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