为htaccess重定向添加级别

时间:2016-07-13 15:49:06

标签: apache .htaccess redirect mod-rewrite url-redirection

我想重定向任何以solve结尾的网址,如此

.html

example.com/article-title.html

此部分应与所有example.com/subfolder/article-title.html 网址匹配,但我无法弄清楚如何添加.html部分。

/subfolder/

此后我应该写什么?

1 个答案:

答案 0 :(得分:1)

尝试:

RewriteEngine on
RewriteRule ^(.*?)\.html$ /subfolder/$1.html [R,L]

这会将/foobar.html重定向到/subfolder/foobar.html