.htaccess将多个URL重定向到其相应的新页面
问题描述:
我想使用.htaccess重定向以下网址:
I'd like to redirect the following urls with .htaccess:
/books/garden 至/garden-books
/movies/dvd-comedy 至/dvd/comedy
/music-soundtracks/new 至/music/soundtracks
/books/garden to /garden-books
/movies/dvd-comedy to /dvd/comedy
/music-soundtracks/new to /music/soundtracks
有人知道该怎么做吗?
答
如果您想要更简单的解决方案,也可以尝试以下方法:
If you want an even simpler solution you can also try this:
Redirect 301 /books/garden /garden-books
Redirect 301 /movies/dvd-comedy /dvd/comedy
Redirect 301 /music-soundtracks/new /music/soundtracks
旧网址首先位于重定向301"之后,然后是新网址.
The old url is first after "Redirect 301", then the new url.