dqfaom241360 2012-06-24 23:27
浏览 41
已采纳

htaccess将所有流量重定向到非图像文件到另一个站点,并将所有图像流量重定向到单个图像

I have a handful of sites I am taking down for a while due to a recent hosting company move, and my primary focus being shifted towards a large project else where, that will ultimately leave my sites down and out for awhile.

So what I need to at the least do is drop an htaccess file in all the domains in question and have all non image based traffic point towards a domain that will actually be up and running, a redirect 301 or whatever, and then have a similar logic applied to just images so I can have images being hosted elsewhere like old form posts point to a single image again on the same domain that will be up.

I need to do this because my server error logs are filling up 10k+ lines an hour due to all the 404 and file not found issues from the other domains. Actually Ideally I would like to point all traffic to one lone file, and then use that file to dump the errors in a database, but use that same file to serve a single image in the event that it was an image request.

Are either of these to logics possible?

  • 写回答

1条回答 默认 最新

  • doremifasodo0008008 2012-06-24 23:38
    关注

    The following should work:

    RewriteEngine on
    RewriteRule \.(jpg|jpeg|png|gif)$ http://yournewsite.com/imagetoshow.png [NC,L,R]
    RewriteRule (.*) http://yournewsite.com [R]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址