简体   繁体   中英

Htaccess with formulaic wildcard redirects

I have two types of links that I need to redirect.

Links were top level such as example.com/p123456234 but now should be clients.example.com/p123456234 .

There are many links that follow this same order (letter then 9 numbers) and I was looking for a wildcard redirect to take care of all of these at once instead of having to type them all in manually.

RewriteRule ^([a-z]{1})([0-9]{9})$ http://clients.example.com/$1$2 [R=301,L]

The wildcards here will limit the character count per type (letter and numbers). If it matches, it'll go to the new destination with a 301 redirect.

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