【问题标题】:Visit localhost(wordpress blog) from Internet with correct data paths instead of "http://localhost/..."使用正确的数据路径从 Internet 访问 localhost(wordpress 博客),而不是“http://localhost/...”
【发布时间】:2014-10-30 12:44:07
【问题描述】:

我正在尝试通过 Internet 到我的 localhost wordpress 安装在我的设备上测试我的不同移动媒体查询。

转发效果很好,我可以看到服务器和 HTML 结构,但其余的没有。图片、CSS文件等重要文件的数据路径仍然是

"http://localhost/..." 而不是"XXX.XXX.X.XXX(the actual ip)"

我不想更改 wordpress 数据库,所以我的问题是有没有办法摆脱路径中的 localhost 部分并将其替换为实际 ip?

我尝试使用 .htaccess 文件,但这比它的帮助更令人困惑......

系统详情:

  • WIN 8 (ACER)
  • 带有转发端口的dlink路由器(TCP/UDP: 25565)
  • XAMPP 3.2.1
  • Apache 端口 80、443

提前感谢您的帮助,抱歉我的英语不好。

【问题讨论】:

    标签: wordpress .htaccess mod-rewrite localhost portforwarding


    【解决方案1】:

    要在不编辑数据库的情况下更改路径,在测试期间编辑 wp-config.php 并添加

    define('WP_HOME', 'http://your-ip');
    define('WP_SITEURL', 'http://your-ip');
    

    之前

    /* That's all, stop editing! Happy blogging. */
    

    线。完成测试后,只需删除这两行即可。

    (来源:http://codex.wordpress.org/Changing_The_Site_URL#Edit_wp-config.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-24
      • 1970-01-01
      • 2016-05-30
      • 2020-09-01
      • 2020-05-10
      • 2014-09-26
      • 2018-01-17
      相关资源
      最近更新 更多