I want to redirect 301 to the below URL
worpress.com/NewsInfoPrint?id=13624
to
wordpress.com/news/13624/
// number is ID post in WordPress and I need for all posts to do that, so the number is dynamic
how can I do that?
Please try this one.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^\/NewsInfoPrint$
RewriteCond %{QUERY_STRING} ^id=([0-9]*)
RewriteRule ^(.*)$ \/news/%1/? [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.