繁体   English   中英

如何使用 htaccess 删除 wordpress 中的子目录

[英]How to remove subdirectory in wordpress using htaccess

我需要将 url 从:

http://example.com/*/a/any.html
http://example.com/*/b/any.html
http://example.com/*/c/any.html

至:

http://example.com/a/any.html
http://example.com/b/any.html
http://example.com/c/any.html

如果直接访问:

http://example.com/a/any.html
http://example.com/b/any.html
http://example.com/c/any.html

保持这种方式

提前感谢大家的帮助

如果/subdir是您需要删除的子目录,那么您可以在根.htaccess文件的顶部,在现有的 WordPress 指令之前尝试以下内容:

RewriteRule ^subdir(/(a|b|c)/[\w-]+\.html)$ $1 [R=302,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM