简体   繁体   English

301使用.htaccess的特定字符串重定向URL

[英]301 redirect urls with specific string for .htaccess

I'm new to this coding. 我是这种编码的新手。 I've searched all over for ways to do this but I have not come up with a working solution. 我到处都在寻找实现此目的的方法,但是我没有想出可行的解决方案。 I'm not even sure if I am looking for the correct thing. 我甚至不知道我要寻找正确的事情。 I've been looking at query_string, but am stumped. 我一直在看query_string,但很困惑。

Basically, I would like to 301 redirect a URL such as http://domain.com/page12345.html to http://domain.com/page23456.html Where the "page12345" may read any digits and any number of digits. 基本上,我想301将诸如http://domain.com/page12345.html之类的URL重定向到http://domain.com/page23456.html,其中“ page12345”可以读取任何数字和任何数字。 All pages in that format would redirect to a set page. 该格式的所有页面都将重定向到设置页面。

Thanks for your help! 谢谢你的帮助!

This rule should redirect any request that matches /page*.html where * is any combination of numeric characters 此规则应重定向与/page*.html匹配的所有请求,其中*是数字字符的任意组合

RewriteEngine On
RewriteRule ^/page([0-9]+)\.html http://domain.com/page23456.html [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM