How to rewrite a folder in WordPress?

I think you may be mixing up a couple of concepts here. Use the new template page you made and name it archive-portfolio.php. This will display all portfolio post types in your new template at yoursite.com/portfolio and the url for the portfolio items should take care of itself. They will still be at yoursite.com/portfolio/item1 so no need to change the permalinks – or slug. If you want to change the single item display you need to edit single.php, change the name to single-{post_type}.php and it will be used automatically

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)