简体   繁体   中英

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.

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. 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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