gpt4 book ai didi

php - WAMP 的远程访问重定向到重复的 url

转载 作者:可可西里 更新时间:2023-11-01 13:27:24 34 4
gpt4 key购买 nike

当我从本地网络上的远程设备访问 WordPress 网站时,即:www.test.local WAMP 决定将此请求重定向到看起来像 www.test.local 的 url http/www.test.local/ 我会得到一个错误。但是,当我从主计算机(使用 WAMP)访问 url 时,不会发生重定向。我试图删除主要的 wordpress htaccess。如果网站只有 index.html 就不会出现这个问题。

我从错误日志中得到的所有信息:

[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/ -> 
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri ''
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/ ->
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '.' to uri ''
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] pass through C:/Users/{MyUser}/work/test/www/
[www.test.local/sid#1a426ce7a18][rid#1a4296ec5d0/subreq] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/index.php -> index.php
[www.test.local/sid#1a426ce7a18][rid#1a4296ec5d0/subreq] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri 'index.php'
[www.test.local/sid#1a426ce7a18][rid#1a4296ec5d0/subreq] [perdir C:/Users/{MyUser}/work/test/www/] pass through C:/Users/{MyUser}/work/test/www/index.php
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] add path info postfix: C:/Users/{MyUser}/work/test/www/www.test.local -> C:/Users/{MyUser}/work/test/www/www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/www.test.local/ -> www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri 'www.test.local/'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] add path info postfix: C:/Users/{MyUser}/work/test/www/www.test.local -> C:/Users/{MyUser}/work/test/www/www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/www.test.local/ -> www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '.' to uri 'www.test.local/'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] RewriteCond: input='C:/Users/{MyUser}/work/test/www/www.test.local' pattern='!-f' => matched
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] RewriteCond: input='C:/Users/{MyUser}/work/test/www/www.test.local' pattern='!-d' => matched
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] rewrite 'www.test.local/' -> '/index.php'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] trying to replace prefix C:/Users/{MyUser}/work/test/www/ with /
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] trying to replace context docroot c:/Users/{MyUser}/work/test/www with context prefix
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] internal redirect with /index.php [INTERNAL REDIRECT]
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334a4b68/initial/redir#1] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/index.php -> index.php
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334a4b68/initial/redir#1] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri 'index.php'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334a4b68/initial/redir#1] [perdir C:/Users/{MyUser}/work/test/www/] pass through C:/Users/{MyUser}/work/test/www/index.php
[www.test.localhttphttp/sid#1a426ce7a18][rid#1a4426f31f0/initial] [perdir C:/Users/{MyUser}/work/test/www/] add path info postfix: C:/Users/{MyUser}/work/test/www/www.test.localhttp -> C:/Users/{MyUser}/work/test/www/www.test.localhttp/www.test.local/
[www.test.localhttphttp/sid#1a426ce7a18][rid#1a4426f31f0/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/www.test.localhttp/www.test.local/ -> www.test.localhttp/www.test.local/

我的虚拟主机文件:

<VirtualHost *:80>
ServerName localhost2.local
ServerAlias *.*.local
VirtualDocumentRoot "c:/Users/{MyUser}/work/%2/%1/"
<Directory "c:/Users/{MyUser}/work/">
ServerSignature Off
Options Indexes FollowSymLinks IncludesNoExec
AllowOverride All
Order allow,deny
Allow from all
# Insert the following:
Require all granted
</Directory>
</VirtualHost>

如果我将使用标准 WP 生成的 .htaccess :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

结果是 URL 被重定向到 www.test.localhttphttphttp... 等,直到达到限制...在远程设备上是 WAMP pc IP 作为代理。知道重定向源自何处吗?

编辑:更新日志 - 这是显示重写跟踪的内容。当从本地主机访问时,直到第 9 行都是一样的,然后它像往常一样调用 Assets 等...

最佳答案

编辑:这似乎不是问题所在,因为问题的更新很清楚。仍然将它留在这里,以供可能会发现它有用的随机 google 员工使用。

要更新您的 wordpress 站点的 URL:

您可以将option_name 的“home”和“siteurl”更新为option_value 的“http://www.test.local/” '(两者的值相同)在你的 wp_options 表中 -

     UPDATE [yourWPDB].wp_options
SET option_value='http://www.test.local/'
WHERE option_name = 'home' OR option_name = 'siteurl'

您还可以将以下行添加到您的 wordpress 根目录中的 wp-config.php 文件中以进行更新 -

     define('WP_SITEURL', 'http://www.test.local/');
define('WP_HOME', 'http://www.test.local/');

关于php - WAMP 的远程访问重定向到重复的 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48042742/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com