gpt4 book ai didi

apache - 使用 htaccess 将所有子页面重定向到另一个子页面

转载 作者:行者123 更新时间:2023-12-04 18:10:17 26 4
gpt4 key购买 nike

我有一个在 Apache 服务器中运行的旧站点,该站点已在 Google 中编入索引。我希望将所有这些索引链接重定向到我的新网站(因为旧页面不再存在。)

所以我希望将我所有的子页面重定向到我的新根页面

我有如下页面

http://itdost.com/answer-now/Aerobics
http://itdost.com/answer-now/HTML
http://itdost.com/answer-now/Culture

我对每个使用以下重定向代码
Redirect 301 /answer-now/Engineering http://www.itdost.com/questions/
Redirect 301 /answer-now/Food http://www.itdost.com/questions/
Redirect 301 /answer-now/ASP http://www.itdost.com/questions/

但是由于站点结构很大,我希望在一行中完成,而不是为每个重定向写一行

像下面这样的东西。
Redirect 301 /answer-now/% http://www.itdost.com/questions/

但是上面的代码似乎不起作用

最佳答案

试试这个:

RedirectMatch 301 ^/answer-now/ http://www.itdost.com/questions/

关于apache - 使用 htaccess 将所有子页面重定向到另一个子页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15363731/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com