问题
I'm trying to redirect http://www.domain.com/post/155851321646/post-slug
to http://www.kaleandcaramel.com/post-slug
(this is actually redirecting old Tumblr URLs to Wordpress URLs)
the closest I came was this:
RewriteRule ^/?post/([0-9]+).(.*?)$ http://www.domain.com/$2 [L,R=301]
but it's not working.
回答1:
Use this instead:
RewriteRule ^post/[0-9]+/([^/]+)$ http://www.domain.com/$1 [L,R=301]
Let me know any problems.
来源:https://stackoverflow.com/questions/42035836/301-redirect-reg-expression-in-htaccess