在 WordPress 博客中更改端口号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16334094/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:13:35  来源:igfitidea点击:

Changing Port number in WordPress blog

wordpressportwampserver

提问by Keshab

First of all I installed wamp server on port 8081 (Because there was IIS on 80). the word process was installed successfully and blog was running smoothly. Now I stopped the IIS and set the apache port to 80. But the application is redirecting to port 8081. (Also I copid the wordpress folder to my live domain, in there also it is redirecting to port 8081.) In which file, I need to change the port number? (I have already changed the port number in httpd.conf.)

首先,我在端口 8081 上安装了 wamp 服务器(因为 80 上有 IIS)。word进程安装成功,博客运行流畅。现在我停止了 IIS 并将 apache 端口设置为 80。但是应用程序正在重定向到端口 8081。(我还将 wordpress 文件夹复制到我的实时域,在那里它也重定向到端口 8081。)在哪个文件中,我需要更改端口号吗?(我已经在 httpd.conf 中更改了端口号。)

Thank You in Advance. :)

先感谢您。:)

采纳答案by user850010

Go to Dashboard > Settings > Generaland check what you have for the options:

转到仪表板 > 设置 > 常规并检查您有哪些选项:

  • WordPress Address (URL)
  • Site Address (URL)
  • WordPress 地址 (URL)
  • 站点地址 (URL)

回答by Michael Sobczak

I had an issue where the original port I had specified when I installed WP was changed. I couldn't log into wp-admin because WP kept redirecting to the old port. I used phpMyAdmin to edit the wp_optionstable. Both the siteurland homerecords used the old port. With phpMyAdmin, you can edit cells directly without having to export/import. I thought I'd add this as an answer just in case it helps someone else down the road.

我有一个问题,我在安装 WP 时指定的原始端口被更改。我无法登录 wp-admin,因为 WP 一直重定向到旧端口。我使用 phpMyAdmin 来编辑wp_options表格。无论是SITEURL家庭记录中使用的老港口。使用 phpMyAdmin,您可以直接编辑单元格而无需导出/导入。我想我会添加这个作为答案,以防万一它可以帮助其他人。

Or use a SQL like this:

或者使用这样的 SQL:

update wp_options SET option_value = 'http://your-domain/wordpress:new-port' where option_id = 1 and option_name = 'siteurl';

update wp_options SET option_value = 'http://your-domain:new-port/wordpress' where option_id = 2 and option_name = 'home';

回答by Khachornchit Songsaen

I found same problem but I'm using xampp.

我发现了同样的问题,但我正在使用 xampp。

ScenarioI have setup another new server using xampp in a different port (8090), then I transferred the existing WordPress to the new server but it was still keeping redirection to the original port.

场景我在不同的端口 (8090) 中使用 xampp 设置了另一个新服务器,然后我将现有的 WordPress 转移到新服务器,但它仍然保持重定向到原始端口。

SolutionsUpdated the option_valuein the table wp_optionsin mysql to the new port. Here is an example updated query.

解决方案将mysql中wp_options表中的option_value更新为新端口。这是一个示例更新查询。

UPDATE `wordpress`.`wp_options`
SET
`option_value` = 'http://localhost:8090/wordpress'
WHERE `option_id` = 1 or `option_id` = 2;

回答by Andy D

If you just want to do it quickly you can change the values in the database. Connect to the [mysql] db for your blog and update the values in the wp_options table.

如果您只想快速完成,您可以更改数据库中的值。连接到您博客的 [mysql] 数据库并更新 wp_options 表中的值。

    # mysql -u root -p

    > use [yourWordpressDBName]

    >    UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl.com:80','http://www.newurlcom:8080') WHERE option_name = 'home' OR option_name = 'siteurl';

And then connect in your browser- the url is changed!

然后在您的浏览器中连接 - 网址已更改!

I had to do this to get a 2nd docker instance of WP working on a different port on the host.

我必须这样做才能让 WP 的第二个 docker 实例在主机上的不同端口上工作。