大网数据广告活动
网站运营与故障问答

1&1 Ionos hijacking my error pages

· 52CE 我爱测

I have a website hosted by ionos (formerly 1&1), they have an annoying "feature" (*) whereby an incorrect page request is hijacked and sent to a third party. The source code for the page I'm redirected to has this script:- <scrip…

问题原文

原帖链接 · deep64blue · CC BY-SA 4.0

I have a website hosted by ionos (formerly 1&1), they have an annoying "feature" (*) whereby an incorrect page request is hijacked and sent to a third party.

The source code for the page I'm redirected to has this script:-

        <script type="text/javascript">
        document.write(
                '<script type="text/javascript" language="JavaScript"'
                        + 'src="//sedoparking.com/frmpark/'
                        + window.location.host + '/'
                        + 'IONOSParkingUK'
                        + '/park.js">'
                + '<\/script>'
        );
    </script>

I was directed to this FAQ which guides me through a custom 404 error page that should prevent this

https://www.ionos.co.uk/help/hosting/html-and-css/create-your-own-error-pages-linux-webhosting

I have set up an .htaccess file like this

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /error_404.html
ErrorDocument 404 /error_404.html

and the error_404.html has this (with my own site instead of example.com):-

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Error 404</title>
</head>
<body>
<h3>This should not have happened. The page you requested does not exist (anymore).</h3>
<p><a href="https://example.com/index.php">Go to the Home page.</a></p>
</body>
</html>

I uploaded both to my website last night but on checking this morning the hijacking is still taking place.

Any ideas what I'm doing wrong? I'm on to IONOS at the moment but wanted thoughts here as well.

(*) I regard this "feature" as a security exposure and reason to move my domain elsewhere and close the account but I need this fixed in the meantime.

已采纳解答

原帖链接 · MrWhite · CC BY-SA 4.0

Make sure you're not seeing a cached response... clear your browser cache, browse with developer tools open and cache disabled (on the Network tab), incognito mode, try a different browser, etc.

That IONOS help article is misleading / dated.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /error_404.html
ErrorDocument 404 /error_404.html

Hhhmmm, this is a bit silly. You should not need the Rewrite... directives here. Delete this and try simply resetting the 404 error document to default instead:

ErrorDocument 404 default

This should serve the Apache default 404 response. If that works then consider creating a custom error document.

Aside: (Not the cause of the problem...)

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

An XML document - seriously? I doubt that you are sending an application/xml mime-type with this response.

You probably want the error response to be plain old text/html...

  • Remove the XML prolog (first line).
  • Change the DOCTYPE to simply <!DOCTYPE html>
  • Remove the xmlns attribute on the html element.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。