如何使用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)$ [R=302,L]
如果 子目录 实际上是任何子目录,请尝试以下操作:
RewriteRule ^[^/]+(/(a|b|c)/[\w-]+\.html)$ [R=302,L]
我需要将 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)$ [R=302,L]
如果 子目录 实际上是任何子目录,请尝试以下操作:
RewriteRule ^[^/]+(/(a|b|c)/[\w-]+\.html)$ [R=302,L]