2

我通过 localtunnel (http://progrium.com/localtunnel/) 共享静态站点没有问题,但我似乎无法让 WordPress 站点工作。

我的本地 WordPress 站点在 MAMP 服务器上运行,没有任何问题。

我也不确定是什么问题。我在想这可能与无法访问 MySQL 数据库有关?

谁能告诉我如何通过 localtunnel 访问在 localhost 上运行的 WordPress 站点?

谢谢阅读。

4

2 回答 2

0

我在 localtunnel 方面没有大量经验,但 Forward 确实支持 WordPress,并且有一个关于如何使其工作的常见问题解答:https ://forwardhq.com/support/faq#how-do-i-use-forward- with-wordpress,它可能会帮助您追踪您的问题......或者至少为您提供另一种选择。

于 2013-01-05T07:00:48.707 回答
0

把它放在你的 wp-config 中:

/* THIS IS CUSTOM CODE CREATED AT ZEROFRACTAL TO MAKE SITE ACCESS DYNAMIC */
/* WORKS FOR LOCALTUNNEL!!!!!! */

$currenthost = "http://".$_SERVER['HTTP_HOST'];
$currentpath = preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME']));
$currentpath = preg_replace('/\/wp.+/','',$currentpath);
define('WP_HOME',$currenthost.$currentpath);
define('WP_SITEURL',$currenthost.$currentpath);
define('WP_CONTENT_URL', $currenthost.$currentpath.'/wp-content');
define('WP_PLUGIN_URL', $currenthost.$currentpath.'/wp-content/plugins');
define('DOMAIN_CURRENT_SITE', $currenthost.$currentpath );
define('ADMIN_COOKIE_PATH', './');
define('FS_METHOD', 'direct');
define( 'WP_ENVIRONMENT_TYPE', 'local' );

我在没有 WP_CONTENT_URL、WP_PLUGIN_URL 和 ADMIN_COOKIE_PATH 的情况下成功使用了它,但将它们包括在此处是因为它们位于此处的原始代码中:https ://wordpress.stackexchange.com/questions/179559/relative-or-dynamic-site-可能的网址

于 2022-01-20T21:09:13.883 回答