Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 将带有常规表达式的301重定向到具有类似计数的其他url_.htaccess_Redirect_Mod Rewrite_Url Rewriting_Friendly Url - Fatal编程技术网

.htaccess 将带有常规表达式的301重定向到具有类似计数的其他url

.htaccess 将带有常规表达式的301重定向到具有类似计数的其他url,.htaccess,redirect,mod-rewrite,url-rewriting,friendly-url,.htaccess,Redirect,Mod Rewrite,Url Rewriting,Friendly Url,我在网站上移植了我的文章,CMS系统转换了网址 我需要重定向URL,类似于: 示例,案例1。URL末尾的相同文章名称和不同编号: 原始URL: 源URL 示例,案例2。URL末尾的相同文章名称和不同编号,但与其他子文件夹: 原始URL: 源URL 非常感谢您,祝您圣诞快乐。请您尝试以下内容,并用展示的样品进行书写和测试。请确保在测试URL之前清除浏览器缓存。如果要重定向(也更改浏览器中的URL),则在两个规则中添加带有L标志的R=301 RewriteEngine ON RewriteRule

我在网站上移植了我的文章,CMS系统转换了网址

我需要重定向URL,类似于:

示例,案例1。URL末尾的相同文章名称和不同编号:

原始URL:

源URL

示例,案例2。URL末尾的相同文章名称和不同编号,但与其他子文件夹:

原始URL:

源URL


非常感谢您,祝您圣诞快乐。

请您尝试以下内容,并用展示的样品进行书写和测试。请确保在测试URL之前清除浏览器缓存。如果要重定向(也更改浏览器中的URL),则在两个规则中添加带有
L
标志的
R=301

RewriteEngine ON
RewriteRule ^folder/name-of-the-article-r929/?$ folder/2087-name-of-the-article [L]
RewriteRule ^folder0/folder/name-of-the-article-r929/?$ folder/2087-name-of-the-article [L]
这将考虑您要重写
http://localhost:80/folder/name-of-the-article-r929/
http://localhost:80/folder/2087-文章名称

http://localhost:80/folder0/folder/name-of-the-article-r929/
http://localhost:80/folder/2087-文章名称

其中,
localhost
可以是您的域名