开发者

have dynamic segments in htaccess as part of a static redirect

开发者 https://www.devze.com 2023-02-27 01:03 出处:网络
I\'m trying to make half of a redirect dynamic while the other is static revelant to the dynamic segment.

I'm trying to make half of a redirect dynamic while the other is static revelant to the dynamic segment.

^img/default/?$ assets/default/themes/ [QSA,L]

what I want it to work with is something like

/img/default/folder1/folder2/img.png -> /assets/default/themes/folder1/folder2/img.png

another use that I want to be able to work is

/img/default/folder1/img.png -> /assets/default/themes/folder1/img.png

without making a rewrite rule for every single possible url i may have restricting me from making some 开发者_StackOverflow社区dynamic references.

Will something like this work?


Try these rules in your .htaccess file:

RewriteEngine on
Options +FollowSymlinks -MultiViews

RewriteRule ^img/default/(.*)$ /assets/default/themes/$1 [R=301,L,NC]
0

精彩评论

暂无评论...
验证码 换一张
取 消