I am new at this. How can I rewrite this in .htaccess correctly?
My visitor access: http://www.example.com/old/xxx/?id=1
But actually source is from: http://www.example.com/new/(same name with xxx)/1.html
I am new at this. How can I rewrite this in .htaccess correctly?
My visitor access: http://www.example.com/old/xxx/?id=1
But actually source is from: http://www.example.com/new/(same name with xxx)/1.html
You can try this
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteCond %{REQUEST_URI} ^/old/xxx/?id=%1\.html$
RewriteRule ^(.*)$ http://www.siteurl.org/new/xxx/?id=%1\.html [L,R=301]