htaccess的所有点击量重定向到一个页面(410飘) [英] .htaccess to Redirect All Traffic to One Page (410 Gone)

查看:207
本文介绍了htaccess的所有点击量重定向到一个页面(410飘)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个是关闭了大门的客户端。我们要重定向进入他们的领域新的一页的index.html有几张图片在_img子目录中的所有流量。 (页面解释发生了什么,有什么现有客户可以与他们目前的订单预期,等等。)

We have a client that is closing its doors. We want to redirect all traffic that goes to their domain to a new page index.html with a few images in the _img subdirectory. (The page explains what happened, what current customers can expect with their current orders, etc.)

我读过有关可能使用HTTP 410飘的最佳途径,在技术上解释机器人等,该网站不存在,不回来了,并且不提供转发地址。什么是做到这一点的.htaccess文件的最佳方式,而直接用户提供了全新的index.html?

I've read about possibly using HTTP 410 Gone as the best way to technically explain to bots, etc. that the site is not there, isn't coming back and isn't providing a forwarding address. What would be the best way to do this in an .htaccess file, and direct users to the new index.html?

推荐答案

您可以使用 mod_rewrite的< /一>这一点。

You can use mod_rewrite for this.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^index\.html$ index.html [L,R=410]

此规则将改写请求不存在的文件的的index.html 的,并伴随着响应发送410状态code。但是这需要Apache 2中的 R = 4XX 的仅因为Apache 2。

This rule will rewrite requests to non-existing files to index.html and send the 410 status code along with the response. But this requires Apache 2 as R=4xx is only available since Apache 2.

这篇关于htaccess的所有点击量重定向到一个页面(410飘)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆