站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Importing from Movable Type to WordPress
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
=零碎的内容= ==Importing a Huge Number of Posts== ==导入许多文章== If you don't have administrative control of the server (root access), then [http://wordlog.com/archives/2004/07/29/importing-large-movabletype-text-files/ Importing a Large Number of Posts] has relevant links and help. This should be helpful if your import process dies before completing the import. The php installation on your webserver may have a low script timeout, or if the file is too large, your server may run out of memory. This is what's happening when you see a blank, white page, during the import, or your browser says "Done" before WordPress says "Have Fun!" after the import. 如果你对服务器(根目录权限)没有管理控制权限,那么[http://wordlog.com/archives/2004/07/29/importing-large-movabletype-text-files/ 导入许多文章]有相关的链接和帮助。如果导入中途终止了,这很有用。你的网页服务器上安装的php脚本停留时间可能较短,或者如果文件太大,你的服务器内存可能不够。这样,导入过程中,你会看到空白的网页,或者先看到浏览器显示"完成",导入后,WordPress显示"玩得开心!"。 If you do have root access to the server, edit php.ini and increase the maximum memory setting. For a large import (e.g. 5MB), increase the script memory to 100MBs and restart apache. When the import is complete, restore the limit to what it was originally and restart apache again. 如果你不能够访问服务器,编辑php.ini并且增加最大的内存设置。对于大量的导入(如5兆字节),将脚本内存增加到100兆字节,并且重启apache。导入完成后,将内存恢复为先前的状态并且重启apache。 ==Preserving Permalinks== ==保留 Permalinks== Search Engines such as [http://google.com Google] will still link to the old Movable Type generated [[WordPress:Glossary#URI and URL|URLs]] when linking to your articles. This is true of other websites too, that may have linked to your posts or articles. It is your best interests to preserve those links, to prevent visitors following those links from seeing a "404: article not found" error page. The following steps will help you preserve the links, depending on how the permalinks were configured on your Movable Type weblog. 搜索引擎,如[http://google.com Google]链接到你的文章的时候,仍然会链接到旧的Movable Type产生的[[WordPress:Glossary#URI and URL|URLs]]。这也同样适用于其它链接到你的文章或者帖子的站点。你对保存这些链接很感兴趣,避免点击这些链接的访客会看到"404: 没有发现文章"错误页面。根据permalinks在你的Movable Type博客上的配置情况,下面的步骤会帮助你保存这些链接。 ===Using an MT Individual Entry Template for Redirection=== ===为Redirection使用MT 单独文章模板=== Alex King's solution provides a [http://www.alexking.org/software/wordpress/mt-wp-redirect.zip Movable Type template for individual entries], which you can use to generate pages that will redirect visitors to the corresponding WordPress pages. However, this method requires that you maintain the Movable Type installation, as also the pages generated by it, which will do the redirection. Alex King的解决方法提供[http://www.alexking.org/software/wordpress/mt-wp-redirect.zip 单篇文章的Movable Type模板],你可以使用这个模板创建网页,将访客导向相应的WordPress页面。然而,这种方法需要你维护安装的Movable Type,以及Movable Type创建的页面,这个页面起着导向功能。 ===Using .htaccess for redirection=== ===为redirection使用 .htaccess === Matt's method uses the [[WordPress:Glossary#.htaccess|.htaccess]] file for redirection. Matt使用[[WordPress:Glossary#.htaccess|.htaccess]]文件,来导向。 Create a Movable Type template like the following, have it output to <tt>redirect.php</tt> in your WP root directory: 创建如下的Movable Type模板,并且将模板输出到你的WP根目录的<tt>redirect.php</tt>中: <pre> <?php require('wp-config.php'); header('Content-type: text/plain'); ?> <MTEntries lastn="999999"> Redirect Permanent /archives/<$MTEntryID$>.html http://www.example.org/archives/<$MTArchiveDate format="%Y/%m/%d"$>/ <?php echo sanitize_title("<$MTEntryTitle$>"); ?> </MTEntries> </pre> <pre> <?php require('wp-config.php'); header('Content-type: text/plain'); ?> <MTEntries lastn="999999"> Redirect Permanent /archives/<$MTEntryID$>.html http://www.example.org/archives/<$MTArchiveDate format="%Y/%m/%d"$>/ <?php echo sanitize_title("<$MTEntryTitle$>"); ?> </MTEntries> </pre> If your entry IDs in MovableType are padded with zeroes (0), then change the line above to 如果你的MovableType中的文章ID都是零(0),将上述的行,改为 <pre> Redirect Permanent /archives/<$MTEntryID pad="1"$>.html http://www.example.org/archives/<$MTArchiveDate format="%Y/%m/%d"$>/ <?php echo sanitize_title("<$MTEntryTitle$>"); ?> </pre> <pre> Redirect Permanent /archives/<$MTEntryID pad="1"$>.html http://www.example.org/archives/<$MTArchiveDate format="%Y/%m/%d"$>/ <?php echo sanitize_title("<$MTEntryTitle$>"); ?> </pre> Also, if your used the "dirify" option, for example, when in MT, if you had: 如果你使用"dirify"选项,例如,在MT中,如果你有: * Archive Type: Individual, *归档类型:单篇, * Archive File Template: <MTEntryTitle dirify="1">.php, *归档文件模板:<MTEntryTitle dirify="1">.php, * quotes in title etc, *标题中的引号等等, Use: 使用: <pre> Redirect Permanent /archives/<MTEntryTitle dirify="1">.php http://www.example.com/index.php?s=<$MTEntryTitle encode_url="1"$> </pre> <pre> Redirect Permanent /archives/<MTEntryTitle dirify="1">.php http://www.example.com/index.php?s=<$MTEntryTitle encode_url="1"$> </pre> or if the extension for the pages were ".html", instead of the ".php" above, use: 或者如果网页的扩展名为".html",而不是以上的".php",请使用: <pre> Redirect Permanent /archives/<$MTEntryID$>.html http://www.example.com/index.php?s=<$MTEntryTitle encode_url="1"$> </pre> <pre> Redirect Permanent /archives/<$MTEntryID$>.html http://www.example.com/index.php?s=<$MTEntryTitle encode_url="1"$> </pre> ===Using .htaccess and mod_rewrite for redirection=== ===为redirection使用.htaccess 和 mod_rewrite === Apache 1.3 and above have a module, called mod_rewrite, that allows URL to be seamlessly rewritten on the fly by the server. This can be used to preserve the previous permalinks from a MovableType installation. To use mod_rewrite, the module must be installed and the FollowSymLinks option must be enabled for your blog directory. If these two conditions are true, then it's as easy as creating a .htaccess file with the following lines in it: Apache 1.3以及更高的版本,有个模,称为mod_rewrite,这个模,能够使得服务器不留痕迹地重写URL。可以使用这个模,保存安装MovableType时,先前的permalinks。要使用mod_rewrite,必须安装模,而且必须为你的博客目录激活了FollowSymLinks选项。如果这两个条件是真的,那么使用将下面的行置入其中,与创建.htaccess文件一样容易。 <pre> RewriteEngine on RewriteRule archives/0*(\d+).html /uri/to/blog/index.php?p=$1 RewriteRule index.rdf /uri/to/blog/index.php?feed=rdf RewriteRule index.rss /uri/to/blog/index.php?feed=rss RewriteRule index.xml /uri/to/blog/index.php?feed=rss2 </pre> <pre> RewriteEngine on RewriteRule archives/0*(\d+).html /uri/to/blog/index.php?p=$1 RewriteRule index.rdf /uri/to/blog/index.php?feed=rdf RewriteRule index.rss /uri/to/blog/index.php?feed=rss RewriteRule index.xml /uri/to/blog/index.php?feed=rss2 </pre> * Note that this will also preserve RSS and RDF feeds that may be being used by third party sites. *注意,这也能保存了第三方站点使用的RSS和RDF feeds。 ===Preserving the Numerical Post Ids=== ===保存文章的Ids数字=== If you are using WordPress 2.0 or newer, you will need to use Joshua Zader's solution: [http://www.muditajournal.com/archives/000280.php Mudita Journal: Importing from MT to WordPress] 如果你正使用WordPress2.0或者更新的版本,你需要使用Joshua Zader的解决方法: [http://www.muditajournal.com/archives/000280.php Mudita 日记: 从 MT 向 WordPress导入] The information below largely pertains to older versions of WordPress. 下面的信息大多数是关于旧版本的WordPress。 If you want your imported posts in WordPress to have the same numerical post ids as in Movable Type, use [http://site-essential.com/wpstuff/mt-numeric-import.zip Kathy's MT-Numeric-Id Importer]. Note that this might not work very well, if you had "padded" numeric ids in Movable Type. However, a peek into the code, and a little familiarity with PHP should help you fix this, if required. 如果你希望WordPress中导入的文章与Movable Type中的文章ids相同,请使用[http://site-essential.com/wpstuff/mt-numeric-import.zip Kathy的MT-Numeric-Id Importer]。注意,如果你已经将Ids数字,"置入"Movable Type中,这可能不能够很好地运行。然而,只要扫视代码,稍微熟悉PHP,你就能够解决这个问题。 Another option is to use [http://drbacchus.com/wordpress/index.php?p=611 Dr. Bacchus' Solution] for the same problem. 另一个选项是使用[http://drbacchus.com/wordpress/index.php?p=611 Dr. Bacchus的解决方法]解决相同的问题。 See also: http://scott.yang.id.au/2004/06/wordpress-migration-notes/ 也看看:http://scott.yang.id.au/2004/06/wordpress-migration-notes/ ===Forcing Wordpress to Use the Movable Type Permalink Structure=== ===迫使 Wordpress 使用Movable Type Permalink 结构=== Allan Barizo provides a solution that forces Wordpress to [http://www.bankblog.info/2005-12/from_mt_to_wp_using_the_same_permalinks_as_movable_type.html use the same permalinks as Movable Type]. However, since Movable Type does not always stick to a set number of characters in the entry_basename column, also known to WordPress users as a "slug" or %postname%," there are sometimes a few Page Not Found (404) errors. It is recommended that this method be used in conjunction with the strategies outlined above. It involves changing the permalink structure under "Options" to Allan Barizo提供了一种解决方法,迫使WordPress[http://www.bankblog.info/2005-12/from_mt_to_wp_using_the_same_permalinks_as_movable_type.html 使用相同的permalinks 作为 Movable Type]。然而,因为Movable Type并不总是遵循entry_basename栏中固定数目的字符,WordPress用户认为是"slug" 或者 %postname%,",有时候没有发现一些网页(404)错误。建议将这个方法与上面列的策略一起使用。包括在"选项"下面将permalink结构,更改为 <pre>/archives/%year%/%monthnum%/%postname%.html</pre> <pre>/archives/%year%/%monthnum%/%postname%.html</pre> Since the %postname% in Wordpress substitutes dashes for spaces, it may be desirable to install the [http://codex.wordpress.org/Plugins/Underscore_Permalinks Underscore Permalinks Plugin]. You may wish to defer this in case the solutions below do not work. 因为Wordpress中的%postname%将破折号替换为空格,更易于安装[http://codex.wordpress.org/Plugins/Underscore_Permalinks Underscore Permalinks 插件]。防止下面的解决方法不能够运行,你可能想要推迟操作。 Generally, a SQL Query must be run on the wp_posts table in the WordPress MySQL database. This is because every Movable Type installation has a different %postname% length cutoff point. (The cutoff point in Movable Type can be seen under Settings, New Entry Defaults tab, Basename Length for the value). On the contrary, WordPress displays the whole URL. Before running this SQL query, replace "15" with the number of characters in the Basename Length field for the particular MT installation. Remember, to back up your MySQL database before performing this operation. 一般来说,SQL查询必须在WordPress MySQL数据库中的wp_posts表格上运行。因为安装的每个Movable Type都有不同的%postname%长度切断点。(在设置下面可以看到Movable Type中的切断点,新文章默认标签,参数值的Basename长度)。与此相反,WordPress显示整个URL。运行这个SQL查询之前,将"15"替换为Basename长度栏中的字符数目,以供安装MT。记住,执行这个操作之前,备份你的MySQL数据库。 <pre>UPDATE wp_posts SET post_name=SUBSTRING(post_name,1,15)</pre> <pre>UPDATE wp_posts 设置post_name=SUBSTRING(post_name,1,15)</pre> This query assumes that all of the posts in the database are imported from MovableType. Also note that any subsequent posts written or imported after running this query will follow the unlimited %postname% WordPress rule. In other words, this query will not have any effect on later post permalinks. 这个查询假定数据库中的所有文章从MovableType中导入。同时注意,运行这个查询之后,任何后来写的或者导入的文章,都会遵循无约束的%postname% WordPress规则。换句话说,这个查询对稍后发表的permalinks没有任何影响。 If the Movable Type blog is rather old, you may have upgraded Movable Type and changed it to use long URLs (more than 15 characters) for your entries. In this case, additional work may be needed. Let's assume that prior to September 1, 2005 your MT blog had a hard coded 15 character entry_basename limitation. You upgraded on September 1, 2005 and set the entry_basename limit to 50 characters. So an entry titled "This is a very long entry" written on August 30, 2005 had an entry_basename of "this_is_a_very" in Movable Type. (Movable Type will strip off the ending underscore.) This means that Page Not Found (404) errors when search engines provide these URLs. You may be able to fix many of these link errors by using phpMyAdmin to determine when the entry_basename size increased in your Movable Type MySQL database. Once you have determined the date then you can use SQL to fix all entries before this date to have the original 15 character limitation. Of course you don't want this change to affect those after this date. Example: 如果Movable Type博客时间非常旧,你可能需要升级Movable Type并且将其更改,使得其为文章使用更长的URLs(多于15个字符)。这时,可能需要额外的操作。假如在2005年9月1日之前,你的MT博客有个hard coded 15个字符 entry_basename 限制。你在2005年9月1日升级,并且将 entry_basename限制为50个字符。在2005年8月30日编写的,标题为"这是篇很长的文章" 的文章,拥有Movable Type "this_is_a_very" 的entry_basename。(Movable Type会去除结尾的下划线。) 这意味这搜索引擎提供这些URLs的时候,网页找不到(404)错误。通过使用phpMyAdmin,决定什么时候entry_basename 大小会在你的Movable Type MySQL数据库中增加,你可能会解决这些链接错误。确定好日期之后,你可以使用SQL在这个日期之前,处理好所有文章,拥有最初的15个字符的限制。当然,这个日期之后,你不希望这些变化会有影响。例如: <pre>UPDATE wp_posts SET post_name=SUBSTRING(post_name,1,15) WHERE post_date < '2005-09-01'</pre> <pre>UPDATE wp_posts 设置post_name=SUBSTRING(post_name,1,15) WHERE post_date < '2005-09-01'</pre> There will likely still be inconsistencies. Some post_name values will contain a post_name ending in an underscore. This will cause page not found errors for these URLs. This SQL will clean up these posts, reducing but likely not eliminating this problem. 可能仍有不一致的情况。有的post_name参数值包含post_name的下划线结尾部分。这会致使这些URLs出现找不到网页的错误。这个SQL会整理这些文章,减少这个问题,但是可能不能清除这个问题。 <pre>UPDATE wp_posts SET post_name = SUBSTRING(post_name,1,(length(post_name) -1)) WHERE RIGHT(post_name,1) = '_'</pre> <pre>UPDATE wp_posts SET post_name = SUBSTRING(post_name,1,(length(post_name) -1)) WHERE RIGHT(post_name,1) = '_'</pre> The next step is to change all dashes in the post_name field in WordPress to underscores. This can be done with this command: 下一步是要将WordPress post_name栏中的所有破折号更改为下划线。可以使用这个命令操作: <pre>UPDATE wp_posts SET post_name=REPLACE(post_name, '-', '_')</pre> <pre>UPDATE wp_posts SET post_name=REPLACE(post_name, '-', '_')</pre> Mark D. Hamill wrote a [http://www.occams-razor.info/mt3.3_to_wp2.3_link_check.txt utility] that may help show the posts where the permalink is inconsistent between Movable Type and WordPress. It was tested using Movable Type 3.3 and Wordpress 2.3. You will need to save the file with a .php extension and change some script variables to match your instance of MySQL. Of course it must be placed on your server and run from it with an appropriate URL. Once bad links are identified they can be changed using phpMyAdmin or a similar tool by carefully editing the post_name column for the appropriate rows in the wp_posts table. Rerun the utility until no link inconsistencies are found. Mark D. Hamill 编写[http://www.occams-razor.info/mt3.3_to_wp2.3_link_check.txt utility] 能够帮助显示permalink在Movable Type和WordPress之间相一致的文章。已经使用Movable Type3.3和WordPress2.3进行了测试。你需要使用.php扩展名,保存文件并且更改一些脚本变数,以匹配你的MySQL。当然必须放在在你的服务器上,使用适当的URL运行。一旦识别了坏的链接,可以使用phpMyAdmin或者相似的工具更改,为wp_posts表格中的一些排,仔细地编辑post_name 栏。直到没有链接不一致情况,再运行utility。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)