search

Home  >  Q&A  >  body text

How to set up the same website, different domain names, and different background images?

Dear brothers. Excuse me, I am a novice. I have bound multiple domain names to the same web page. For example, if I want www.bd.com to access it, the background image should be changed to b.jpg. Otherwise, the default is the background image set before

小蓝小蓝567 days ago634

reply all(2)I'll reply

  • 小蓝

    小蓝2024-04-15 13:15:55

    thank you boss

    reply
    0
  • WBOY

    WBOY2023-06-29 10:48:32

    <?php
    $domain = $_SERVER['HTTP_HOST'];
    
    if ($domain == 'www.bd.com') {
    $backgroundImage = 'b.jpg';
    } else {
    $backgroundImage = 'default.jpg'; // 默认背景图
    }
    ?>
    
    <!DOCTYPE html>
    <html>
    <head>
    <style>
    body {
    background-image: url(<?php echo $backgroundImage; ?>);
    }
    </style>
    </head>
    <body>
    <!-- 页面内容 -->
    </body>
    </html>

    reply
    1
  • Cancelreply