I understand that you are talking about Wordpress
This is simple: go to permalinks section, select the custom URL format at put a %category% /%postname% format
Better explained here for example:
https://www.ostraining.com/blog/wordpress/wordpress-permalinks-multiple-categories/
i already use this URL format in my websiteI would say, have the exact same structure in the sub folder. Then have a htaccess rule in your root folder that permanently redirects all the urls (or some of the urls, if needed) to your sub folder; with keeping query strings the same.
Or, did you mean to just add something to the query string, and not having a separate installation?
i want make a new subfolder then i want move some categories with their posts to to the new sub folder by a plugin . will this break links ??