如何使用.htacess重定向修改后的URL

编程入门 行业动态 更新时间:2024-10-09 22:24:33
本文介绍了如何使用.htacess重定向修改后的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想将我的网站移至新域.但是,面临永久链接结构的问题.例子,

I want to move my website to a new domain. But, facing a problem with Permalink structure. Example,

Old Structure: oldsite/salman-khan-biography/ New Structure: newsite/salman-khan-movies/

实际上,从永久链接的末尾仅更改单个单词. 我尝试了以下代码,但显示在新域中找不到404.

Actually, just single word will be changed from the end of permalinks. I tried below codes, but it's showing 404 not found on the new domain.

RewriteEngine on RewriteCond %{HTTP_HOST} ^oldsite [NC,OR] RewriteCond %{HTTP_HOST} ^www.oldsite [NC] RewriteRule ^(.*)$ newsite/$1 [L,R=301,NC]

推荐答案

在旧网站htaccess中尝试以下操作.

Try with below in your old website htaccess.

RewriteEngine On RewriteCond %{REQUEST_URI} (.+)\-biography/?$ RewriteRule ^ newsite/%1-movies/ [R=301]

更多推荐

如何使用.htacess重定向修改后的URL

本文发布于:2023-11-02 07:14:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551716.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   重定向   htacess   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!