[英].htaccess 301 redirects for part of url
我正在重新设计我的网站,并在此过程中重组了一些链接结构。
要执行永久重定向,我正在使用以下代码(.htaccess)
RedirectMatch permanent old-link($|\.html) http://thedomain.com/new-link.url
我正在使用CMS,更改类别的链接会更改url的路径,如下所示:
thedomain.com/old-category-link/old-article-url.html
至
thedomain.com/new-category-link/old-article-url.html
我应该如何编码(.htaccess)具有以下内容的任何URL的重定向
thedomain.com/old-category-link
(即
thedomain.com/old-category-link/old-article.html
thedomain.com/old-category-link/old-article-2.html
thedomain.com/old-category-link/old-article-999.html
)
至
thedomain.com/new-category-link/any-articles-old-url.html
谢谢
不确定要重定向到的内容,但是这样吗?
RedirectMatch permanent old-category-link(.*) http://thedomain.com/new-category-link$1
如果有人要求:
没有答案对我有用。 这是我的Wordpress网站的功能。
例:
OLD URL: http://website.com/xxx/yyy/picture.png
NEW URL: http://website.com/wp-content/picture.png
因此,我想用WordPress的常规/ wp-content /路径替换/ xxx / yyy / 。
将其放在您的.htaccess文件中。
RewriteEngine on
RedirectMatch 301 /xxx/yyy/(.*) http://website.com/wp-content/$1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.