yarondav
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: length of post name in permalinksHi, sorry for the late response, forgot to check back here again after everything sorted out, not very polite of me.
Maybe I didn’t phrase myself clearly. I didn’t mean that I changed the SQL I’m using to pull the posts, but that I used an UPDATE statement to go over all the imported posts, and change the post name to the first 15 chars.
Something like (Not the actual statement I used, I use here 200 as a close place holder for the last imported post, and I didn’t test this exact one, but it should be similar except for maybe some typos)UPDATE wp_posts SET post_name=SUBSTRING(post_name,1,15) WHERE id<200
And of course if someone uses this in a case where the import isn’t the first thing done with the blog, then the limits in the WHERE clause have to be either ID from both sides, or date based, or something else that will fit better. In this case, I didn’t have any previously inserted posts, so that was easy.
Like I said, the only reason I didn’t do it to begin with is that when the idea of changing the post slug came up, I thought of the work of doing it manually…
Forum: Fixing WordPress
In reply to: length of post name in permalinksHi.
I want to use links with titles, like your second one. This is what I used before, and I see no reason to downgrade to less…In any case, I finally did a replace SQL like I mentioned in my previous post in this thread. So now all the older imported posts are accessible with the shorter title links, which is about what I wanted.
Thank you.
Forum: Fixing WordPress
In reply to: length of post name in permalinksOK, Thanks.
It finally hit me I don’t need to manually change the posts, but can just run an SQL to change the post_name field on the wp_posts table to include only the first 15 chars of the imported posts.
So this ends this problem for me.Forum: Fixing WordPress
In reply to: length of post name in permalinksI’ll do that if I can’t find an automated way to do it, but the thought of manually checking and changing names on 200 posts doesn’t exactly thrill me. I’d prefer to spend even twice the time on something that would do that automatically…
But yes, it does so far seem as the only option I can get to work, so I may just have to do it. Thanks.
Forum: Fixing WordPress
In reply to: Mod-rewrite rule for _ and .html? (permalinks from MT)I’m currently in the process of moving from TypePad (using MoveableType) to WordPress myself. Also hosted on dreamhost, so the conditions should match…
I used the same mturl plugin from idly.org, and got it to work fine (originally received the same 404 errors) after adding an exit(); command past the two header lines.
Location of rules in the .htaccess matters, since it’s running them by order. Although if you use the [L] flag, it doesn’t matter as it’s not parsed anymore anyway. But putting yours first ensures the url won’t get caught by the WP rules.
Since I want to keep the old TP/MT links working, but not keep supporting them, I used redirects to the new permalink format. That way at least search engines will update their indexes to use the new format instead.
Both the MT blog and the new one were on /blog/ under the domain name. If that’s different for you, you can change the RewriteBase to fit the old one, and the /blog/ text here for the new one.
What I did was add another set of rules before the ones WP creates automatically, with the same RewriteBase and RewriteCond clauses (except of course smaller number to skip on the conditional rule for real files and dirs) And the following rules:1. For categories, I keep the default WP style of /category/name/ while on the MT one it was /name/index.html , so the rule is
RewriteRule ^(.+)/index\.html$ /blog/category/$1/ [r=permanent,L]
Which redirects to the new categories permalink format, and is caught again on the second pass after the redirect. This works fine
2. For the posts, both my original format and the new format where in the form /year/month/name , except that MT had the .html extension, and WP is set to end with a / . So I used:
RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9a-zA-z\-])\.html$ /blog/$1/$2/$3/ [r=permanent,L]
Again, after the redirect, this permalink will get handled by the WP rules, but users will see the new permalink on their browsers and not the old one, like if you don’t redirect.
And that’s that. Not sure if it’s the best way, this is my first time of handling an .htaccess file, but it does the job. I have a different problem with the length of the posts’ names, but I’ll start a different thread on that. Hope this helped you any.