htaccess 301 重定向文件夹,但不是子文件夹

编程入门 行业动态 更新时间:2024-10-19 21:26:10
本文介绍了htaccess 301 重定向文件夹,但不是子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要重定向自:

example/folder

到example/newfolder

但是离开:

example/folder/subfolder

它在哪里.这可能吗?我似乎无法在不引起一堆重定向混乱的情况下实现它.

Where it is. Is this possible? I can't seem to make it happen without causing a heap of redirect chaos.

推荐答案

我刚刚遇到了这个问题,这是我想出的解决方案.我更喜欢这种方法,因为它不会重定向任何子目录.

I just ran into this and here's the solution I came up with. I prefer this method because it doesn't redirect any subdirectory.

RewriteCond %{REQUEST_URI} ^/root-directory[/]? RewriteCond %{REQUEST_URI} !^/root-directory/+[/]? RewriteRule (.*) www.example/ [R=301,L]

更多推荐

htaccess 301 重定向文件夹,但不是子文件夹

本文发布于:2023-10-31 13:10:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546184.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   重定向   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!