I've moved a WordPress website from an old version to a new version. Blog URLs are broken now. How to create a redirect that will take only the last portion of the url and append it to the domain. Here is an example:
http://www.dummydomain/3454/uncategorized/post-name-here ==> http://www.dummydomain/post-name-here
the 3454 and the uncategorized are different between posts so I can't hardcode that.
I searched allot but couldn't find anything related to this. Any guidance or help would be appreciated.
You can use this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule (?:^|/)([^/]+)/?$ /$1 [L,NE,R=302]
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.