我是mod_rewrite的新手。我想将Wordpress根目录中的所有htm文件重定向到localhost Wordpress安装上的docs/filename.htm,这意味着localhost/a.htm应该转到>localhost/docs/a.htm.如何实现这一点?我使用/web作为Wordpress的基本目录。我试过了,但没有成功。
RewriteEngine On
RewriteBase /web/
RewriteRule ^([^/]*?).htm$ docs/$1.htm
还有可能只从根文件夹重定向吗?-即localhost/a.htm将重定向到本地主机/docs/a.htm,但该规则不应适用于本主机/otherdir/a.htm
如有任何帮助,我们将不胜感激。
RewriteEngine On
RewriteRule ^(.*).htm$ docs/$1.htm [L,NC]
试试这个