This is a simple CSS-only (no-JavaScript), on-page-load, modal message box. I adapted it from https://codepen.io/peiche/pen/vhqym by Paul @peiche
<style>
.forwarding-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
transition: opacity 200ms;
visibility: visible;
opacity: 1;
z-index: 1;
}
.forwarding-overlay .dismiss {
position: absolute;
width: 100%;
height: 100%;
cursor: default;
}
.forwarding-overlay:target {
visibility: hidden;
opacity: 0;
}
.forwarding-overlay .message-box {
margin: 150px auto;
padding: 20px;
background: #fff;
border: 1px solid #666;
width: 800px;
box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
position: relative;
color: #666;
}
.forwarding-overlay .message-box h2 {
margin: 0 0 12px;
}
.forwarding-overlay .message-box .close {
position: absolute;
width: 24px;
height: 24px;
top: 20px;
right: 20px;
opacity: 0.8;
transition: all 200ms;
font-size: 24px;
font-weight: bold;
text-decoration: none;
text-align: center;
}
.forwarding-overlay .message-box .close:hover {
opacity: 1;
}
.forwarding-overlay .message-box .content {
max-height: 400px;
overflow: auto;
}
.forwarding-overlay .message-box a {
color: blue;
text-decoration: underline;
}
.forwarding-overlay .message-box a:hover {
color: #00d;
}
.forwarding-overlay .message-box p {
margin: 0 0 1em;
}
.forwarding-overlay .message-box p:last-child {
margin: 0;
}
</style>
<div id="oldsite" class="forwarding-overlay">
<a class="dismiss" href="#newsite"></a>
<div class="message-box">
<h2>This Website Has Moved</h2>
<a class="close" href="#oldsite">X</a>
<div class="content">
<p>Thank you for visiting, but this site has moved/migrated.</p>
<p>[old website name] is now located at <a href="https://new-website-address.tld/">https://new-website-address.tld/</a></p>
</div>
</div>
</div>