【问题标题】:error 404 with mod_proxy and redirection带有 mod_proxy 和重定向的错误 404
【发布时间】:2017-03-27 11:47:27
【问题描述】:

我试图通过在地址栏中保留现有 url 来实现重定向。我以某种方式实现了它,但无论我在哪个页面重定向我都会收到错误 404。我启用了 mod_proxy 和 proxy_http。这是我的 htaccess 代码:

#Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^(.*) http://demo.example.com/$1 [P]

有什么想法吗?我的服务器是带有 plesk 的 vps,如果需要,我可以访问任何 conf 文件

Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-042stab120.5 x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Fri Nov 11 19:59:21 2016 from adsl-152.176.58.250.tellas.gr
root@lvps92-51-132-79:~# curl -vv http://gazzetta.edentalbook.com
* Rebuilt URL to: http://gazzetta.edentalbook.com/
* Hostname was NOT found in DNS cache
*   Trying 92.51.132.79...
* Connected to gazzetta.edentalbook.com (92.51.132.79) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: gazzetta.edentalbook.com
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Sun, 13 Nov 2016 20:59:19 GMT
* Server Apache is not blacklisted
< Server: Apache
< Access-Control-Max-Age: 1000
< Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Access-Control-Allow-Origin: http://demo.edentalbook.com
< X-Powered-By: PleskLin
< MS-Author-Via: DAV
< Vary: Accept-Encoding
< Content-Type: text/html; charset=UTF-8
< Set-Cookie: PHPSESSID=62hctjah1g95c33lprkk2q9m50; expires=Sun, 20-Nov-2016 20:59:19 GMT; path=/; HttpOnly
< X-Powered-By: PleskLin
< Transfer-Encoding: chunked
<

【问题讨论】:

  • 您能否尝试对您的网站运行详细的“curl”请求并将输出与您的问题一起粘贴到此处?像这样: curl -vv
  • @melgart 我需要在哪里运行它?在htaccess里面?在 php 代码中还是在终端中?
  • 抱歉,在终端中。这将向您的网站显示更详细的请求
  • @melgart 刚刚编辑

标签: apache .htaccess httpd.conf plesk mod-proxy


【解决方案1】:

请求中的 HTTP 标头“Host”似乎已传输,但在服务器上不匹配。

您可以通过以下方式reset this header

Header set Host "demo.edentalbook.com" 

或者将域别名 gazzetta.edentalbook.com 添加到它托管的域 demo.edentalbook.com

【讨论】:

    猜你喜欢
    • 2013-05-05
    • 1970-01-01
    • 2020-11-25
    • 2015-02-15
    • 2017-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多