开发者

htaccess rewrite directory

开发者 https://www.devze.com 2022-12-23 03:58 出处:网络
I moved my website from the /v1/etc... directory to th开发者_StackOverflowe /v2/etc... directory and would like to make a permanent redirect in htaccess. Can someone help me?You can use either mod_rew

I moved my website from the /v1/etc... directory to th开发者_StackOverflowe /v2/etc... directory and would like to make a permanent redirect in htaccess. Can someone help me?


You can use either mod_rewrite:

RewriteEngine on
RewriteRule ^v1(/.*)?$ /v2$1 [L,R=301]

Or mod_alias:

Redirect permanent /v1 /v2


Put this:

RewriteEngine On
RewriteRule /v1/(.\*) /v2/(.\*) [R=301,L]

in your .htaccess file.


RedirectMatch permanent /v1/(.*) /v2/$1
0

精彩评论

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

关注公众号