Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 基于404和url中文本的htaccess重定向_.htaccess - Fatal编程技术网

.htaccess 基于404和url中文本的htaccess重定向

.htaccess 基于404和url中文本的htaccess重定向,.htaccess,.htaccess,我需要知道如何重定向用户时,一个404是发现和url包含特定的文本 假设我有一个url: www.mysite.com/northeast-articles/cooking-with-butter.html 由于cooking-with-butter.html文章未发布,该URL现在已过期 我想知道如何在我的htaccess文件中执行此操作: 如果引用文本生成404 参考文本包含“东北条款” 然后将用户发送到www.mysite.com/northeast-main-page 使用这种方法,当文

我需要知道如何重定向用户时,一个404是发现和url包含特定的文本

假设我有一个url:

www.mysite.com/northeast-articles/cooking-with-butter.html

由于cooking-with-butter.html文章未发布,该URL现在已过期

我想知道如何在我的htaccess文件中执行此操作:

如果引用文本生成404

参考文本包含“东北条款”

然后将用户发送到www.mysite.com/northeast-main-page

使用这种方法,当文章未发布并因此过期时,它不会生成404,而是将用户带到“主”页面。我们不必为每一篇过期的文章手动编写重定向代码


有人能帮忙吗?

可能重复欢迎使用SO。有一个类似的问题,有一个公认的答案。请检查一下。谢谢你,西弗,但那不是我需要的。我需要先触发404,然后如果404是由包含“东北文章”的URL触发的,我想重定向用户。你提到的帖子似乎总是进行重定向。重定向不是有条件的。