Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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 htaccess即';s重定向一个';它已经不存在了_.htaccess - Fatal编程技术网

.htaccess htaccess即';s重定向一个';它已经不存在了

.htaccess htaccess即';s重定向一个';它已经不存在了,.htaccess,.htaccess,我想将不存在的整个文件夹重定向到主页 我尝试: RedirectMatch 301 ^/folder_thats_no_longer_exists/$ / RedirectMatch 301 ^/folder_thats_no_longer_exists / RedirectMatch 301 /folder_thats_no_longer_exists / 但这种解决方案不起作用: 事实上,在尝试之后,URL仍然是:但是带有主页的内容(这会导致显示错误) 我只想: 这与301重定向有关 谢谢

我想将不存在的整个文件夹重定向到主页

我尝试:

RedirectMatch 301 ^/folder_thats_no_longer_exists/$ /
RedirectMatch 301 ^/folder_thats_no_longer_exists /
RedirectMatch 301 /folder_thats_no_longer_exists /
但这种解决方案不起作用:

事实上,在尝试之后,URL仍然是:但是带有主页的内容(这会导致显示错误)

我只想: 这与301重定向有关


谢谢

您可以在站点根目录顶部使用此规则。htaccess:

RedirectMatch 301 ^/folder_thats_no_longer_exists(/.*)?$ /
在测试此更改之前,请记住完全清除浏览器缓存