我正在尝试创建 .htaccess 重定向,以便文件夹重定向到其正确的页面。
例如... http://example.com/contactus/help.html将重定向到http://example.com/contact-us/help.html或http://example.com/contactus至http://example.com/contact-us
最佳答案
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^example\.com/contactus/(.+)$ [NC]
RewriteRule ^ http://example\.com/contact-us/%1 [R=301,L]
</IfModule>
关于.htaccess - 动态 .htaccess 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7477746/