.htaccess 301 重定向部分网址
我正在重新设计我的网站,并在此过程中重组一些链接结构。
为了进行永久重定向,我使用以下代码(.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
你
I am redesigning my website and in the process restructuring some of the linking structure.
To do the permanent redirects I am using the following code (.htaccess)
RedirectMatch permanent old-link($|\.html) http://thedomain.com/new-link.url
I am using a CMS and changing the link for a category changes the path of the url like so:
thedomain.com/old-category-link/old-article-url.html
to
thedomain.com/new-category-link/old-article-url.html
How should I code (.htaccess) the redirect of any URL that has
thedomain.com/old-category-link
(i.e
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
)
to
thedomain.com/new-category-link/any-articles-old-url.html
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不太确定您要求重定向到什么,但是是这样的吗?
如果有人请求:
Not exactly sure what you are asking to be redirected to, but is it something like this?
This will make is so if someone requests:
没有答案对我有用。这是我的 WordPress 网站的运行情况。
示例:
所以,我想将 /xxx/yyy/ 替换为 WordPress 的正常 /wp-content/ 路径。
将其放入您的 .htaccess 文件中。
No answer worked for me. Here is what is working with my Wordpress site.
Example:
So, I want to replace /xxx/yyy/ with the normal /wp-content/ path of WordPress.
Put this in your .htaccess file.