Wordpress 本地服务器到现场主机 [英] Wordpress local server to live host

查看:22
本文介绍了Wordpress 本地服务器到现场主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 wordpress 网站.我将文件(wordpress)上传到我的直播主机.所以我的 wordpress 的新实时 url 站点就像这个示例 url http://mywordpress.com/,显示似乎没问题,但是当我开始浏览菜单页面时,它会被重定向到我的本地服务器,而不是 http://mywordpress.com/about-us/ 它去了我的本地主机,就像 http://localhost/mywordpress/about-我们

I am developing a wordpress site. I uploaded the files(wordpress) to my live host. So my new live url site for my wordpress like this sample url http://mywordpress.com/, the display seems to be fine, but when I start browsing the menus page will be redirected to my local server, instead of http://mywordpress.com/about-us/ it went to my localhost like http://localhost/mywordpress/about-us

因此,当我检查页面源代码时,包括样式表在内的所有链接都是指向我本地的链接.即使我使用此代码

So when I checked the page source all the links including the stylesheet is link to my local. even though I use this code

<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="all" />

有点奇怪……但有人知道如何配置吗?

Its kinda weird... but anyone knows how to configure this?

推荐答案

在我看来,您的数据库可能正在使用旧的 url 值.

It sounds to me like your database may be using old values for your url's.

对于可能会或可能不会解决您的问题的快速解决方案,请尝试 http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/.这是一个很棒的插件.如果没有...这是我从本地转移到在线的防弹说明.

For a quick solution that may or may not solve your issue, try http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/ . It's a great plugin. If not... here are my bullet proof instructions for transferring from local to online.

我已经从本地迁移到在线数百次,我认为大多数关于 wordpress 迁移的教程都过于复杂.这是我的方法(假设您已经有了 全新 wordpress 安装和数据库)

I've migrated from local to online hundreds of times and I think most tutorials on wordpress migration are overly complex. Here's my method (assuming you already have a fresh wordpress installation and database)

  1. 转到本地服务器的 phpMyAdmin 并导出您的数据库(但不是作为文件)...只需获取直接的 SQL 文本并复制它.

  1. Go to phpMyAdmin for your local server and export your database (but not as a file)... just get the straight SQL text and copy it.

将该代码粘贴到 Dreamweaver、文本编辑器、coda 或任何可以进行搜索和替换的纯文本文字处理器中.然后搜索http://MyOldWordpressUrl.com/wordpress"(确保最终目录后有NO斜线)并替换为http://MyNewWordpressUrl.com/wordpress".显然不包括引号.确保您的旧 wordpress URL 是正确的.您可以在管理 -> 常规设置中仔细检查.

Paste that code into dreamweaver, text editor, coda or any plaintext word processor that can do a search and replace. Then search for "http://MyOldWordpressUrl.com/wordpress" (make sure there is NO slash after the final directory) and replace with "http://MyNewWordpressUrl.com/wordpress". Obviously don't include the quotation marks. Make sure your old wordpress URL is correct. You can double check in admin -> general settings.

进入您的在线托管的控制面板并转到数据库以进行新的 wordpress 安装(这应该是一个全新的安装,您尚未创建任何帖子或输入任何数据——只是什么wordpress 给你).导出数据库并将其另存为文件(以防万一).现在删除所有表.当它询问您是否确定时单击是".然后单击 SQL 图标(应该在左侧边栏的左上角).这应该打开一个新窗口.现在粘贴第 2 步中的代码,然后单击开始".

Get into your control panel for your online hosting and go to the database for your new wordpress install (this should be a brand new installation where you haven't yet created any posts or input any data-- just what wordpress gives you). Export the database and save it as a file (just in case). Now drop all the tables. Click YES when it asks you if you're sure. Then click on the SQL icon (should be in the upper left hand corner of the left sidebar). This should open a new window. Now paste in your code from step 2 and click GO.

通过 FTP 传输您的主题文件夹.

Transfer your theme folder via FTP.

现在你应该去新的 wordpress install 的 wp-admin.您的用户名和密码将适用.转到添加帖子"并从您的计算机添加任何图像...等待它上传,现在将其删除.这一步是让服务器创建上传文件夹,以 100% 确定由 wordpress 注册并设置为正确的权限.我之前通过 FTP 直接传输上传文件夹浪费了几个小时,所以不要这样做.

Right now you should go to the new wordpress install's wp-admin. Your same User Name and password will apply. Go to "add a post" and add any image from your computer... wait for it to upload, now delete it. This step is to have the server create the uploads folder to be 100% certain is registered by wordpress and set to the correct permissions. I've wasted hours before by transferring the uploads folder directly by FTP, so don't do it.

步骤5在FTP中创建了一个uploads文件夹,现在您可以将uploads文件夹的内容(即2008、2009、2010、2011+子文件夹)拖放到uploads文件夹中.除了一个空文件夹(因为您在步骤 5 中删除了该文件),其中应该没有任何内容,因此如果它警告您,则可以覆盖.

Step 5 created an uploads folder in FTP, now you can drag and drop the contents of your uploads folder (ie 2008, 2009, 2010, 2011 + subfolders) into the uploads folder. There should be nothing in it except an empty folder (because you deleted that file in step 5), so it's fine to overwrite if it warns you.

剩下的唯一步骤是转移您的插件.您可以通过 FTP 来完成,尽管通过添加插件"和搜索 + 安装直接通过 Wordpress 管理员添加它们可能会更快.

The only remaining step is to transfer your plugins. You can do it via FTP, although it's probably faster to add them directly through the Wordpress admin via "add plugin" and search + install.

哦,是的,现在转到永久链接设置并单击默认",更新,然后选择您想要的任何内容 - 您需要将永久链接刷新到.

Oh yeah, now go to permalink settings and click "default", update, then choose whatever you want-- you need to refresh permalinks to.

这是万无一失的...但是您必须对使用 PHP myadmin 有点熟悉/自信.虽然我发现有些widget不能通过这种方式传输,所以你可能需要在传输后再次拖放一些widget(外观->widgets).

That's foolproof... but you have to be somewhat familiar/confident using PHP myadmin. Although I've founds some widgets do not transfer via this method, so you may have to drag and drop some widgets again (appearance -> widgets) after the transfer.

有关第 1 步和第 3 步的说明,请参阅此处的图表:http://webdesignerwall.com/tutorials/exporting-and-importing-wordpress ...但 WDW 教程的其余部分肯定会在某些时候给您带来问题.

For clarification on step 1 and step 3, see the diagrams here: http://webdesignerwall.com/tutorials/exporting-and-importing-wordpress ... but the rest of that WDW tutorial is guaranteed to give you problems at somepoint.

这篇关于Wordpress 本地服务器到现场主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆