本文介绍了.htaccess将文件夹重定向到网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将文件夹及其所有子文件重定向到带有.htaccess文件的URL。
I'm trying to redirect a folder and all its sub files to a URL with a .htaccess file.
但是
Redirect 301 /abc/cba/ www.aaa/将使 /abc/cba/ddd/index.html 重定向到 http:// www。 aaa/ddd/index.html
我想要的是重定向 / abc / cba / / abc / cba / ddd / index.html 到 www.aaa/
有人可以帮忙吗?谢谢。如果不清楚,请通知我。
Could anyone help? Thanks. If anything not clear, please let me know.
推荐答案默认情况下,重定向将路径节点映射到新的路径节点,因此第一个路径之后的所有内容都会附加到目标URL。
By default, Redirect sort of maps the path node to a new path node, so anything after the first path gets appended to the target URL.
尝试:
RedirectMatch 301 ^/abc/cba/ www.aaa/?或者,如果您更愿意使用mod_rewrite而不是mod_alias:
Or if you'd rather use mod_rewrite instead of mod_alias:
RewriteEngine On RewriteRule ^/?abc/cba/ www.aaa/? [R=301,L]更多推荐
.htaccess将文件夹重定向到网址
发布评论