So I have a problem in which I'm attempting to redirect a URL based on whether or not it begins with a certain numbers. I'm needing to redirect a site visitor if the first character of the trailing URL begins with the number "1", then I need to remove the number 1 of the URL and then replace the 1 with a specific directory path.
So here's a specific example to clarify. If the user clicks on (or types in their browser's address bar)
http://www.example.com/1d39g
they would automatically be redirected to
http://www.example.com/product/d39g
Also worth nothing, they individual typing in this URL will be reading it off a label in the mail, they won't always be clicking on a link. I originally had thought of doing this through jQuery, but I thought .htaccess would be the best way to approach this.
激活mod别名,然后将其添加到.htaccess中
RedirectMatch /1(.*)$ /product/$1
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.