dtbrd80422 2016-03-03 05:59
浏览 22

使用.htaccess在一段时间后重定向页面

I am trying to redirect the click a tell HTTP API using .htaccess file.

I need the system to stay on that api page to send a message and then redirect to another page after 10 sec. Here is what i found yet :

   RewriteRule ^mypage\.html$  /mypage2.html [R]

But i want to insert time here for page 1 to stay .

any suggestions ?

  • 写回答

1条回答 默认 最新

  • dongxuan1314 2016-03-03 06:26
    关注

    You can do this via a temporary file handler in your site root. Create a file called timer.php with this code:

    <html>
    <head>
       <meta http-equiv="REFRESH" 
                  content="<?php echo $_GET['delay'];?>;URL=<?php echo $_GET['target'];?>">
    </head>
    </html>
    

    Then have your rewrite as this:

    RewriteEngine On
    
    RewriteRule ^mypage\.html$ timer.php?delay=10&target=/mypage2.html [L,NC]
    

    This will redirect the /mypage.html to /mypage2.html after 10 seconds delay. If you want you can display some custom message/image for these 10 seconds.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用