Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

.htaccess - htaccess rewrite directory

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use either mod_rewrite:

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

Or mod_alias:

Redirect permanent /v1 /v2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...