help with URL rewrite/htaccess needed

Having trouble installing serendipity?
Post Reply
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

help with URL rewrite/htaccess needed

Post by romulus »

Hi,

I'm moving from a wordpress installation to s9y and wanted that the nice URLs you get with mod_rewrite to be the same as with my old wordpress installation, so that no one of my users must change their feed readers, bookmarks and that the google bot finds my site with the same links as ever ;)

In Wordpress following rewrite rules are active in a .htaccess file:

Code: Select all

RewriteEngine On
RewriteBase / 
RewriteRule ^archives/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?category_name=$1&feed=$2 [QSA]
RewriteRule ^archives/category/?(.*) /index.php?category_name=$1 [QSA]
RewriteRule ^archives/author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?author_name=$1&feed=$2 [QSA]
RewriteRule ^archives/author/?(.*) /index.php?author_name=$1 [QSA]
RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/trackback/?$ /wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1 [QSA]
RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1&withcomments=1 [QSA] 
Basically the URLs for articles look like that: http://server/archives/year/month/day/title
for a category like that: http://server/archives/category/name

Can someone with more experience in rewrite rules translate that for me so that s9y can use them?

I would be bery thankful :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: help with URL rewrite/htaccess needed

Post by garvinhicking »

Hi romulus!

I believe that your wish cannot be so easily done. Serendipity operates with Category and Entry IDs which will be different from your old installation. So you'd need to rewrite something like:

Code: Select all

RewriteRule ^archives/category/CoolCat$ /archives/category/2-CoolCat [QSA]
So remapping each text-coded category to its new categoryid.

Basically most of the other rewrites could be dones easier (like the archives stuff) - but I'm somewhat out of time to look into that. Maybe some other users with wordpress-migration-experience can help out here?

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/
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

Post by romulus »

hmm cool idea. Its a little bit of work but I have only six categories so its not too much. ;)

I understand that its a little bit of a problem to rewrite articles because in the old links the id is missing, but I already have thought about some php script wich does some translating with a little help from an extended database.

If someone has a cool and clean idea to rewrite links (other than a php script) I would be appreciated though :)
Post Reply