[英]How to remove subdirectory in wordpress using htaccess
I need to change the url from:我需要将 url 从:
http://example.com/*/a/any.html
http://example.com/*/b/any.html
http://example.com/*/c/any.html
to:至:
http://example.com/a/any.html
http://example.com/b/any.html
http://example.com/c/any.html
and if access directly to:如果直接访问:
http://example.com/a/any.html
http://example.com/b/any.html
http://example.com/c/any.html
keep it that way保持这种方式
thank you all for your help in advance提前感谢大家的帮助
If /subdir
is the subdirectory you need to remove then you can try something like the following at the top of your root .htaccess
file, before the existing WordPress directives:如果/subdir
是您需要删除的子目录,那么您可以在根.htaccess
文件的顶部,在现有的 WordPress 指令之前尝试以下内容:
RewriteRule ^subdir(/(a|b|c)/[\w-]+\.html)$ $1 [R=302,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.